Actually SF spends a great deal of money on homlessness
I think they were up to something like $250 million/year. However, the city has a reputation for year-round livable weather, a higher tolerance for drug abuse and public drinking (which is honestly why a lot of SF homeless are in their position.) and is more accepting of what might be thought of as countercultural behavior. Add the SF housing crisis to that, and you have a LOT of homeless people.
The sad fact is that a lot of the homeless people you see on the SF streets are absolutely unable to manage their own affairs anymore, due to a combination of mental illness, drug addiction and alcohol addiction.