Rankings like these, however, can obscure the factors that go into each decision.

Housing markets, even within a single metro area, typically have local submarkets. Take New York City, for example. Renting in Manhattan is more affordable than buying. But in suburban Westchester County just miles to the north, buying is the more affordable option.

The size of the home can also make a difference. In some markets, renting can be a better deal on larger homes, according to Trulia.

Those calculations are about to change, according to Ken H. Johnson, a professor of real estate at Florida International who has studied the buy-vs-rent question extensively. He believes home prices nationally have bottomed.

"The ship has turned," he said. "Markets should slowly start to recover. Housing will return to its traditional role of a safety investment."

If so, that adds an incentive to buy. And investing in many of the most expensive markets may be even safer.