If you line up the country's 100 richest metros from 1 to 100, household affordability falls as household income rises, even after you consider that middle class families in richer cities have more income. [The graph below considers only the 25 richest US metros to keep city names moderately legible within the computer screen.]

Rich Households = Unaffordable Houses?

The line isn't smooth—and there are exceptions—but the relationship is clear: In general, richer cities have less affordable housing.

But there's a second reason why San Francisco's problem is emblematic of a national story. Liberal cities seem to have the worst affordability crises, according to Trulia chief economist Jed Kolko.

In a recent article, Kolko divided the largest cities into 32 “red" metros where Romney got more votes than Obama in 2012 (e.g. Houston), 40 “light-blue” markets where Obama won by fewer than 20 points (e.g. Austin), and 28 “dark-blue” metros where Obama won by more than 20 points (e.g. L.A., SF, NYC). Although all three housing groups faced similar declines in the recession and similar bounce-backs in the recovery, affordability remains a bigger problem in the bluest cities.

Super-Liberal Cities, Super-Unaffordable Houses

"Even after adjusting for differences of income, liberal markets tend to have higher income inequality and worse affordability,” Kolko said.

Kolko's theory isn't an outlier. There is a deep literature tying liberal residents to illiberal housing policies that create affordability crunches for the middle class. In 2010, UCLA economist Matthew Kahn published a study of California cities, which found that liberal metros issued fewer new housing permits. The correlation held over time: As California cities became more liberal, he said, they built fewer homes.

"All homeowners have an incentive to stop new housing," Kahn told me, "because if developers build too many homes, prices fall, and housing is many families' main asset. But in cities with many Democrats and Green Party members, environmental concerns might also be a factor. The movement might be too eager to preserve the past."

The deeper you look, the more complex the relationship between blue cities and unaffordable housing becomes. In 2008, economist Albert Saiz used satellite-generated maps to show that the most regulated housing markets tend to have geographical constraints—that is, they are built along sloping mountains, in narrow peninsulas, and against nature's least developable real estate: the ocean. (By comparison, many conservative cities, particularly in Texas, are surrounded by flatter land.) "Democratic, high-tax metropolitan areas... tend to constrain new development more," Saiz concluded, and "historic areas seem to be more regulated." He also found that cities with high home values tend to have more restrictive development policies.