Every person who fraudulently evades, or attempts to evade the payment of his fare, while traveling upon any railroad, shall be deemed guilty of a misdemeanor, and upon conviction thereof, shall be punished by a fine of not more than five hundred dollars, or imprisonment not exceeding six months, or by both such fine and imprisonment.