Brewmaniac, I'm a correctional officer at a penitentiary. This is by no means a be all to end all answer, but it is something

A startling amount of the prisoners are on fairly strong medication. Mental health counselors are available 24-7 for serious problems. For severe cases, they can be temporarily placed in a certain spot where they are under constant supervision. We even have a few padded cells and 4 point restraint tables if the need arises. If they are too much to handle at my facility, we move them to a different facility that is more specialized to fit their needs. These are a very small percentage of the inmates whose mental state is different from the norm.
Why aren't they all put in psych wards? Because when they are properly medicated, they act completely normal and really aren't much of a threat to anyone (as a result of their condition, at least.) Sometimes they neglect to take their medication, and some really wierd shit happens. For example: the voices in their heads tell them to do bad things. Many of them will tell one of the staff members when the voices are telling them to do bad things, because they don't want to hurt anyone or get in more trouble. Then you get ahold of the mental health counselors and get them help.
Prisoners have to pay a ridiculously low co-pay for treatment, but when you factor in what they are able to earn ($15-$55 a MONTH, 40+ hours a week) coupled with the taxes and other fees taken out they are only getting about 1/3 of any money that they receive.