Homeless people prefer to go to bigger cities and frequent areas where they can beg for money or scavenge trash. So yes, small communities tend to not have many of them.
The trick with San Francisco, if the city chose to try it, would be to find housing in commuting distance which is cheaper. Such housing wouldn't necessarily need to be in San Francisco, especially if these people don't have work or other ties there...