If the person restrained is confined in jail or is in the custody of a civil officer, the court or magistrate granting the writ shall certify thereon the amount to be paid for the expense of transporting him from the place of imprisonment, and the officer shall not be bound to obey the writ unless that amount is paid or tendered to him.
Mass. Gen. Laws ch. 248, § 9