Where such county and such city unite in the construction and maintenance of a jail and the purchase of land for employment of prisoners, the cost of maintenance shall be divided equally between the city and county except for the cost of providing the food for prisoners. The cost for prisoners charged with or found guilty of offenses against the general criminal laws of the state shall be provided by the county, and the cost for prisoners charged with or found guilty of violating ordinances of the city shall be provided by the city.