Just to provide a specific financial example, our university's private inpatient psychiatric unit - which has 18 beds that are almost always full - loses just over $1 million/year for the healthcare system. The upside of this financial black hole is that our unit is arguably "the place" to get inpatient care in our city: staffing ratios are reasonable (4 RNs, 3-4 MHTs, and 3 MDs for a maximum of 18 patients), the unit is fairly nice, and, being a teaching unit, patients probably get more attention on our unit than anywhere else. That's not to say that it's the only good unit in the area, but it is certainly one of the best.
Many of the sketchy free-standing, for-profit hospitals in our area don't offer anything close to those staffing ratios, and most of the time the MDs don't spend much time with the patients. Inpatient psychiatry is so financially non-viable that over the past couple of years we've lost several hundred beds in the community, completely clogging the ED system since we have nowhere to send people, and the facilities that closed were already themselves fairly sketchy. This results in redirection of patients to inappropriate levels of care, inappropriate treatment, and other issues that ultimately make the system completely dysfunctional. I work in our county hospital ED, and I literally cannot send patients that receive indigent mental health insurance to an inpatient facility on a voluntary basis. It simply won't happen. If someone voluntarily wants to go to the hospital, they clearly aren't "acute" enough to warrant inpatient admission, says the mental health authority. It's a complete farce, and it leaves psychiatrist in the crappy position of having to involuntarilyy admit patients - even if they are willing to be admitted - just so that they can actually get a bed... a bed that they will probably wait at least 2-3 days for.
The surviving hospitals that haven't closed or been shut down have a monopoly on receiving patients that receive the county indigent mental health insurance, so I suspect that they survive solely on volume alone. A couple of these facilities have been on the local news for various scandals - patient abuse, inappropriate administration of emergent medications, assaults between patients, bad conditions, etc. It's a tragedy. But, barring more funding - both from insurance companies and from government authorities - for more beds, nothing is going to change. Unfortunately, the "system" has become so dependent on these sketchy facilities that it would immediately collapse if those beds disappeared.