I hardly doubt the main reason for this is hamsters. Everyone knows the dog/cat thing costs every city hundreds of thousands of dollars a year. They wouldn't need so many rescue groups if there wasn't a problem
On another note though, it just bans the sale in the city limits and from my understanding, you could still breed within the city with no fault. You just can't have a storefront. I'm against the goverment regulating if I can purchase a "companion animal", but at the same time, I am tired of animals going to bad homes. A parent will be less inclined to drive to another city just to get an $8 hamster. And if SF is anything like Atlanta, there are very few places to actually get those animals within the city limits. Unfortunately, the good independant stores have all closed down.