I think you're suggesting that we lock up everyone who has a mental illness, and then release the ones who aren't dangerous.
About 1% of the population has schizophrenia. About 1% of the population has bipolar. Let's say about 1% of the population has a severe personality disorder. If there are about 320m people in the US you're calling for the incarceration of 9,600,000 innocent people.
The vast majority of those people are not a danger to others, or themselves.
What we need to do is invest in community care, have short hospital stays available if needed, and have forensic "secure units" available for the small numbers of people who pose a serious risk of harm to other people or who have committed criminal acts while mentally ill. We do this because it is cheaper; it is more effective; it is safer; and it respects people's human rights.