Any ordinance may provide for the punishment of those who violate its provisions. The punishment for the violation of any ordinance, including the costs charged for the prosecution thereof, shall not exceed a fine of five hundred dollars or imprisonment for 90 days, or both, in the discretion of the court; said imprisonment may be either in the city or county jail, or in any work house in the state which is authorized by law to receive prisoners from the city.