On April 2, 2014, a protester in Oakland, California, mounted a Yahoo bus, climbed to the front of the roof, and vomited onto the top of the windshield.

If not the year's most persuasive act of dissent, it was certainly one of the most memorable demonstrations in the Bay Area, where residents have marched, blockaded, and retched in protest of San Francisco's economic inequality and unaffordable housing. The city's gaps—between rich and poor, between housing need and housing supply—have been duly catalogued. Even among American tech hubs, San Francisco stands alone with both the most expensive real estate and the fewest new construction permits per unit since 1990.

But San Francisco's problem is bigger than San Francisco. Across the country, rich, dense cities are struggling with affordable housing, to the considerable anguish of their middle class families.

Among the 100 largest U.S. metros, 63 percent of homes are "within reach" for a middle-class family, according to Trulia. But among the 20 richest U.S. metros, just 47 percent of homes are affordable, including a national low of 14 percent in San Francisco. The firm defined "within reach" as a for-sale home with a total monthly payment (including mortgage and taxes) less than 31 percent of the metro's median household income.

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?

Trulia

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

Trulia

"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.

One could attempt tying this together into a pat story—Rich liberals prefer to cluster near historic coastal communities with high home values, where they support high taxes, rent control, and a maze of housing regulations to protect both their investment and the region's "character", altogether discouraging new housing development that’s already naturally constrained by geography...—but even that interpretation elides the colorful local history that often shapes housing politics.

I asked Kahn if he had a pet theory for why liberals, who tend to be vocal about income inequality, would be more averse to new housing development, which would help lower-income families. He suggested that it could be the result of good intentions gone bad.

"Developers pursue their own self-interest," Kahn said. "If a developer has an acre, and he thinks it should be a shopping mall, he won't think about neighborhood charm, or historic continuity. Liberals might say that the developer acting in his own self-interest ignores certain externalities, and they'll apply restrictions. But these restrictions [e.g. historic preservation, environmental preservation, and height ceilings] add up, across a city, even if they’re well-intentioned. The affordability issue will rear its head."