Whenever by the terms of this code, or of any other law of the state, it is provided that a prisoner shall be confined in any county jail, such provision shall be construed to authorize any prisoner convicted of a misdemeanor to be confined, with the consent of the city, in any city jail in the judicial district in which the offense was committed, and as to such prisoner so confined in such city jail, the designations, county jail and city jail shall be interchangeable, and in such case the obligations to which the county is liable in case of confinement in a county jail, shall become liabilities of the city where such prisoner is confined in a city jail.
Ca. Pen. Code § 4022