Whenever the public welfare or the safe custody of a prisoner shall require, any district judge in the state of New Mexico in his discretion may order any person charged with the commission of a crime, or any person in the custody of the sheriff of any county in the district of the said judge, to be removed to another county jail, or to the state penitentiary, or to any other place of safety, when, in the opinion of the said district judge, it is advisable that such person or persons shall be removed for any purpose whatsoever.
Where a person, on the order of any district judge has been placed in the state penitentiary or a county jail for safekeeping, the expense incurred by said penitentiary or the sheriff of any county for the maintenance of said prisoner, shall be borne by the county from which said prisoner has been ordered, and said bill of expense shall be made a preferential bill of expense and shall be paid in full before any bill, fees or salaries of such county are paid; provided, however, that the said state penitentiary or sheriff shall only charge for the maintenance of said prisoner the legal rate now allowed by law. This section shall not authorize a charge against a county for expenses relating to any prisoner committed to the penitentiary as a result of a criminal conviction.
NMS § 33-3-15