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 safe keeping 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.
730 ILCS 125/10