Isn’t it the most expensive city because of all the tech workers? Wherever you get a congregation you’ll get that effect (as Austin and Colorado are finding out), and companies generally start where workers are available (that‘a why film and entertainment industries are still largely is in LA, New York, London even if they film around the world)
Only partially. You are correct that congregation does drive up prices. However congregation drives building more housing and other things which drives prices back down. SF has done less to drive prices back down than any other city and as a result has the most expensive housing. Eventually an equilibrium is reached (in practice this is false as things are always changing, but close enough)