(a) The department of correction shall have the authority to collect from the inmate trust fund account of any defendant in its custody those moneys necessary to satisfy any unpaid costs that have been imposed upon the defendant.
(b) When the state has paid the costs in a case accruing under § 40-25-130(5), and the defendant is in the custody of the department of correction, the department shall have the authority to collect from the inmate trust fund account of the defendant those moneys necessary to reimburse the state for the payment of the costs. Any amount so collected shall be deposited in the state general fund.