Putting them in jail prevents them from doing things that the taxpayers don't like: building fires under overpasses, leaving needles and human waste in the streets, harassing passersby, etc. It also puts them in contact with social services, in some cases.
It's not a perfect solution, or even a good one. We can and should develop a more compassionate alternative.
It's not a perfect solution, or even a good one. We can and should develop a more compassionate alternative.