Apologies for the multi post. The joys of a smart phone and a shoddy network connection.
The SF/Oakland metropolitan area, which in all reality the San Jose metropolitan area, is significantly larger that the Buffalo Market. Most are unaware, but the city of San Jose is the 10th largest city in America and the third largest in California (behind LA and San Diego) and SF and Oak are right behind at 4 and 5 respectively.
The Giants and Jets are in the nation's largest market.
Also, SF and the Giants were members of the NFL, Oakland and the Jests were part of the AFL. The fact that they were in those locations so when the merger took place is why they are so close together.
But the Raiders moved to LA, you say. That's true, they did. But in some roundabout way they managed to retain their territorial rights in Oakland, thereby enabling their move back.