The Constitution in its 6th Amendment makes it very clear that in all criminal prosecutions, that the accused shall "… have the Assistance of Counsel for his defence." Further to the point, States and counties are quite aware that they cannot legally prosecute defendants that are unable to afford an attorney, due to their being indigent or similar, so that the State or the county must therefore provide them with an attorney, or such prosecution of a particular case will almost for a certainty be overturned as a violation of Constitutional law.
While in most jurisdictions public defenders are overworked, underpaid, and understaffed, the system as it is, sort of works in the sense that most indigent defendants in one way or another, receive a court appointed attorney that at least takes on the semblance of representing them in court proceedings. Still, with the United States arresting and consequently prosecuting millions upon millions of its own citizens each year, not too surprisingly, funds for the defense of those so accused and without monetary means, cost those States and those counties and therefore the taxpayers of such, quite a lot of money, and thereby, there is often going to be, someone in some place of authority, who knows the law, even knows the spirit of the law, but has a plan to workaround it for the benefit of the status quo.
In other words, States and counties are well aware that charging an hourly wage or even a contract price to an indigent defendant for the services of a public defender is probably something that will not be upheld in a court of law or a court of appeal. On the other hand, charging a "booking fee" or a "processing fee" or a "registration fee" of which, this charge is administered to every single defendant, in which they are legally held responsible to pay, is somehow in some way is able to pass muster. In reality, this fee because it is mandatory, and thereby compelled against all defendants, is in itself, discriminatory, for though each impoverished defendant has a right to an attorney, some of these defendants, because of the amount and burden of this fee, will subsequently elect to not have an attorney, and will in most cases, have to negotiate with the prosecutor and the court, themselves, in which they have neither the experience, savvy, connections, or even the understanding of the ramifications of whatever deal is so made.
For all the States and counties that complain about budget shortfalls, because of the expense of having to utilize public defenders for indigent defendants, the most obvious workaround for this type of problem is for the police and thereby the prosecutorial office to arrest far fewer indigent and oppressed people on what typically are minor criminal offenses of one sort of another; and concentrate their considerable resources instead on arresting only those that actually have money, and lots of it; and thereby spend their time prosecuting things like: corporate criminals, while collar crimes and cons, medical fraud, insurance fraud, and basically all those types of things that people with intelligence but lacking a good ethical compass like to do.
As for those indigent defendants, to keep things really simple, most of the crime, that they are accused of, such as loitering, public drunkenness, petty theft, marijuana possession, vagrancy and so forth, are typically the types of criminal offenses that should be re-categorized into ticket offenses, or infractions, that are not legally felonies or misdemeanors, and the fine structure should be indexed against that persons' personal income.