When the person confined or restrained is in the custody of a civil officer, the court entering the order shall certify thereon the sum to be paid for the expense of bringing the person from the place of imprisonment, not exceeding 10 cents per mile, and the officer shall not be bound to obey it unless the sum so certified is paid or tendered to him or her, and security is given to pay the charges of carrying the party back if he or she should be remanded. If the court is satisfied that the party so confined or restrained is a poor person and unable to pay such expense, then the court shall so state in the order, and in such case no tender or payment of expenses need be made or security given but the officer shall be bound to obey such order.
735 ILCS 5/10-112