A long while ago, the US decided to end state support for mental health treatment facilities. The hospitals and closed wards dedicated to the treatment--and confinement--of the insane were shuttered, and the patients and their families were on their own.
After several years, it became apparent that this decision simply shunted the responsibility of managing dangerous and mentally unstable individuals--particularly those too poor to afford private treatment--to the prison system.
So now all the prisons and jails are also de facto mental health clinics--plus gratuitous punishment that is virtually guaranteed to have no impact whatsoever of the recidivism rate for the subjectively crazy inmates.
Some of my fellow Americans have some rather warped and irrational opinions on mental illnesses, taking them as weakness of character, rather than diseases to be cured, treated, or managed under the direction of a competent specialist. This allows them to rationalize the management of crazy people as someone else's problem, and the struggles faced by those with mental impairments or disorders as largely their own fault. Those people often hold other irrational beliefs. They may also think that one's sexuality is a choice that can be changed. Or they may believe that week-old fetuses have greater value than their mothers. Or they may believe that using a recreational drug is criminal behavior that warrants being locked in a cage for years. And they vote. Those elected to office with the support of their votes may also support their views with legislation as a means of retaining that support for reelection. And so it goes. Rational governance loses sway in the face of an ignorant populace.
I would recommend screening all current prison inmates for objectively measurable symptoms of cognitive impairments, brain damage, and personality disorders, at state expense. Then transfer those with confirmed diagnoses to dedicated treatment facilities, not punishment boxes. And aside from the diagnosed individuals, criminal behavior is itself a symptom of a disease in society. Punishing a poor person for being ignorant and making his own selfish opportunities will not solve the underlying problem, which is that society generally expects work in exchange for the means of survival, and withholds work opportunities from those it finds to be unpopular or otherwise undesirable.
This would be much less severe a problem if the US health care industry were less oriented to private profits and more oriented towards the general welfare. And it would be less severe if "tough on crime" candidates for political office aimed for more prevention and less punishment.