Whenever a prisoner is committed to the jail of one county for a criminal offense committed or charged to have been committed in another, or is transferred to another county for safekeeping or trial, the county in which the crime was committed, or charged to have been committed, shall pay the expenses of the keeping of such prisoner. In civil suits, the plaintiff or defendant shall pay the expenses, in the same manner as if the imprisonment had taken place in the same county where the suit was commenced.
The County Board of the county in which the crime was committed, may require convicted prisoners transferred from such county to reimburse the county for the expenses incurred by their incarceration to the extent of their ability to pay for such expenses. The State's Attorney of the county which incurred the expenses, if authorized by the County Board, may institute civil actions in the circuit court of such county to recover from such convicted confined persons the expenses incurred by their confinement. Such expenses recovered shall be paid into the county treasury.
730 ILCS 125/21