Whenever any person shall, because of a conviction for any misdemeanor or felony, be subject to imprisonment in a county jail, such person may, at the discretion of the court, be confined in any workhouse or other place of imprisonment belonging to any town or city in such county, or in any incorporated city from which said county has been separated by law; provided, the county commission of such county shall have contracted or agreed with the town or city owning such workhouse or other place of confinement for the custody and keeping of such convicts; and cities or towns having no workhouse or houses shall have authority to work convicted persons on the streets, bridges or other public works in such city or town.
§ 546.880, RSMo