The sheriffs or governing bodies of the respective counties of this State shall keep in safe custody all such prisoners as may be committed to them under the authority of the United States until such prisoners are discharged by due course of law of the United States, under the like penalties as in case of prisoners committed under the authority of this State and upon the terms of the resolution of the Congress of the United States at its session begun and held on March 4, 1789. The sheriff or governing body may charge a fee for such prisoners pursuant to the terms and conditions set forth in § 23-19-20.