It is cheaper and easier to provide an apartment than it is a jail cell. This does not solve all the problems with this community, but it is a start. With a fixed address, one can re-establish and get ID documents, which many of the homeless do not have. Established ID allows those who will do so to actually get work and perhaps even keep a job. It can help to end the sort of exploitation often involved with under the table day labor.
Now there are some who will not be helped. They aren't really interested in living any differently. This is not a stereotype, I have been volunteer in the cause of ending or at least relieving the suffering of the homeless for over 20 years now.
Some are just fine living the way they do and only really want a warm dry place to sleep on a cold and damp night. They do the day labor, get paid cash at the end of the day, eat, drink, and smoke with the change in their pockets, and start all over the next day. They literally compare the food in the local jails and try to avoid arrest in areas where the food is lousy. I have been in the circle for such discussions.
However this is the small end of the problem. Most would love a regular job and decent simple place to live, and will work hard for it if given the chance.