Lots of comments about why we have a lack of mental hospitals. I used to teach a grad school course on the history of mental health, but I won't bore with a lecture . But here are two websites that give good background:
https://www.kqed.org/news/11209729/did-the-emptying-of-mental-hospitals-contribute-to-homelessness-here - a 2016 review from KQED that gives an excellent historical background. It cites the invention of chlorpromazine (Thorazine) as the first antipsychotic that, at the time, thought medication could eliminate the need for mental hospitals. Sadly, it was not so. The corresponding history is a jumble of state/federal money that shifts mental health care to the community.
AMA Journal of Ethics - really good perspective - https://journalofethics.ama-assn.org/article/deinstitutionalization-people-mental-illness-causes-and-consequences/2013-10#:~:text=Three forces drove the movement,to save money [8].