Step back for a moment and think about the question you are asking. For example;

What makes a diamond worth more than a ruby? What makes a Rembrandt painting worth more than my daughters Fathers Day card from the third grade? How is it fair that the cars get waterspots in a rainstorm?

The question you are asking is founded in that "wealthy" is a thing rather than it is an artifact of a behavior or event. And that question speaks to my basic point, why are the artifacts (and extrapolations) treated as if they were the important thing in the discussion?

Lets say you won the PowerBall lottery on Wednesday and elected to take the lump sum. $58 Millon, if you live in California you pay 54% in combined federal and state taxes so you clear $26 million dollars. You can now go into San Francisco and qualify to purchase any number of properties. Zillow claims there are over 1,000 homes available to you that you can now afford easily.

Let's say you graduated from college in 1980 and got a job in the Bay Area as a programmer and have lived in a 1 bedroom efficiency apartment since that time and saved all of your excess income in the Vanguard S&P500 mutual fund. Here 36 years later you have about $3.2M available and you can buy any of over 750 homes in San Francisco for cash.

You live in a small two bedroom apartment in Mountain View and your paternal grandfather dies. He left his estate to his grand children and after being distributed between you and your sister you receive $5M. You can now buy a home for cash in San Francisco.

In all of those cases you are now able to buy a house in San Francisco, did "deserving" ever enter in to it? Why or why not?

In economic terms the control of capital moves from actor to actor, sometimes that actor is required to relinquish control (for example you buy food to eat so you give money for food) and sometimes the actor chooses to relinquish control (you trade money for a nice new car) and sometimes the actor chooses to retain control (you loan it to others temporarily in exchange for them giving you back more capital than you loaned them, you do this by putting your money in a savings account, money market, mutual fund, or other investment). The amount of capital you get to control over your lifetime is a mix of luck and work. What you do with it once you get control is entirely up to you of course.

There isn't a social justice issue here, there is just the flow of capital amongst people who choose to use it where they will. It could be you, it could be someone else, but as much as it would be great if it was, the game isn't really is not rigged in the US, and that is doubly true in the Bay Area. Houses are expensive in San Francisco because a tremendous amount of capital is being sent into the economy to create new things. AirBnB raises $100M that is capital that comes in, they spend it on office space (and it flows to construction companies and construction workers) they spend it on engineers and data scientists and it flows to people who are probably reading this list, they spend it on advertising and it flows to advertising agencies or city coffers via bus stop advertising. Most of it flows into the control of people in the area. Some of those people will collect it until they can make competitive offers on a house, others will collect it and then move out of the area, and still others will spend everything they are given on new cars, vacations, and conspicuous consumption. But AirBnB exists because some actors (in this case investors) have moved capital into them, in the hope that later they will be able to exchange the equity in that investment for more capital than they originally sent over.

Are their social justice issues? Sure, but home prices isn't a social justice issue, its an economic artifact. Consider abandoned suburbs of Houston or Detroit where houses were abandoned because there was no capital coming into the city any more (Oil in Houston's case, Cars in Detroit's) It has been offered (but I cannot verify) that the greater metro area of Detroit had at one time housing for over a million people which was abandoned. Think about that when we discuss San Francisco's homeless population of 8,000 to 10,000 people (which is considered "large"). We tax the economy to use that capital to support the mentally ill, the less fortunate, that is a social justice issue. But it has nothing to do with home prices and everything to do with competent governance.