More ammunition for Google bus protesters: Out of 100 metro areas, San Francisco has the second widest gap between rich and poor, according to a new study by Trulia Chief Economist Jed Kolko

The Oakland area ranked 15th and San Jose 20th.

Kolko noted that inequality has increased in 94 of the 100 largest metros since 1990, “and has even accelerated in the past few years,” he wrote.

The place where it has increased the most: San Francisco (which includes San Mateo and Marin counties). A recent study by the Brookings Institution found San Francisco that had the biggest growth in income disparity between 2007 and 2012.

Kolko found two factors that seem to correlate — though not perfectly — with wide income gaps: high housing costs and slower economic growth.

Kolko theorized that expensive housing pushes out low- and middle-income residents, and richer residents bid up home prices and rents. Meanwhile, to compensate for high housing costs, many expensive big cities have created rent control and other programs to preserve low-income housing.

Leaving the middle in the lurch.

He notes that the four cities with the widest income gaps — Fairfield County, San Francisco, New York and Boston — are among the least affordable. “Yet there are many exceptions to this pattern: Detroit, Toledo, New Orleans, and Philadelphia are also quite unequal but are relatively affordable, and on the flip side, Ventura County, Orange County, and Honolulu are more equal but far less affordable.”

He also found that faster-growing metros — measured by employment or construction activity — tend to be less unequal.

“The link between growth and income equality is especially strong for low-income households; in other words, slower job growth (as well as less construction) is associated more with the poor falling farther behind, rather than with the rich pulling farther ahead,” he writes.

If that’s true, shouldn’t San Francisco rank lower on the inequality scale?

Although San Francisco has experienced strong income growth, it ranks in the bottom half of the 100 metro areas in terms of employment growth, Kolko said in an interview. The fastest-growing areas have been places such as Las Vegas; Orlando; Raleigh, N.C.; and the Inland Empire — where cities can build lots of housing, which stimulates job growth. “It’s hard to create a lot of jobs if you aren’t building housing.”

The cities with low job growth have been “economically challenged places like Detroit” and hemmed-in cities such as San Francisco and Boston. “You often see higher home prices and income growth in places that can’t spread out,” Kolko says.

He notes in his study that the growth in inequality in almost every metro area since 1990 “has been more about the rich pulling away from the pack than the poor falling farther behind.”

While some of America’s beleaguered cities would be happy to have a “Google bus” problem (too many well-paid residents making things expensive for everyone else), rising inequality can create political tensions and make it harder for government to meet everyone’s needs, Kolko says.

Although New York City doesn’t have Google buses, many saw the transition from Mayor Michael Bloomberg to current Mayor Bill de Blasio as a backlash against growing inequality in that city.