When a person is confined to the Hennepin County Adult Correctional Facility and a fine is remitted or a sentence is stayed or suspended, the person released on parole, or the release of the person secured by payment of the fine in default of which the person was committed, the prisoner shall not be released except upon order of the court. A written transcript of such order signed by the court administrator and under the court’s seal shall be furnished to the superintendent of the Hennepin County Adult Correctional Facility. All cost of confinement or imprisonment in any jail or correctional facility shall be paid by the municipality or subdivision of government in Hennepin County in which the violation occurred, except that the county shall pay all costs of confinement or imprisonment incurred as a result of a prosecution of a gross misdemeanor.