The main reason a company pays a person in one locale more than another, is that what it costs to retain that person in that locale. If you want a good person in the bay area or is going to cost more that a person in another area.
Cost of living plays a part. But it is really about the other competitors in the area.
But honestly don't be resentful. There are a lot of headaches in the higher pay areas. Like traffic is worse. Is the extra pay worth it? Maybe, maybe not