SF conducts a sort of census of their homeless population. One of the questions asked is where the person lived when they became homeless. The majority are from SF[1]:
> Sixty-nine percent (69%) of respondents reported they were living in San Francisco at the time they most recently became homeless. Of those, over half (55%) had lived in San Francisco for 10 or more years.
The idea that SF "collects" homeless people (from elsewhere) is a myth not supported by data.
[1]: http://hsh.sfgov.org/wp-content/uploads/2017/06/2017-SF-Poin...