For criminal cases, that probably depends on the interest and repayment terms. If its means-contingent repayment without usurious interest, the incentive to plea guilty to avoid the cost of defense would be minimized, though the public expense would, correspondingly, be greater. OTOH, the expense would be going to assure that the guilty, and only the guilty, were punished and the government was less able to get away with punishing the poor-but-innocent to prevent a public image of dealing with problems while failing to actually get the guilty, so there is a public benefit (in addition to "protecting the rights of the accused") that comes from that public expense.