NEW YORK (TheStreet) -- The housing market is almost back, but it still has traps for investors, including some new challenges.

A lot of the data out this week is certainly better. Existing home sales rose 5.1% in May to an annual rate of 5.3 million, the best since late 2009. That's comparable to levels in the early 2000s, just as the housing bubble began inflating. New-home sales for May came in at an annual rate of 546,000 -- the latest in a series of solid gains. And mortgage rates, while rising, are still lower than they were a year ago. Consulting firm IHS says new-home sales could top 640,000 by next year, which is still way down from the pre-bubble peak of 1.2 million in 2005, said IHS economist Stephanie Karol.

Even homebuilder earnings are responding, some. Lennar (LEN) - Get Report said second-quarter profit rose by a third, as new-home deliveries rose 20% and average selling prices rose 8.1%. KB Home (KBH) - Get Report said new-home deliveries rose by 33%, as the number of communities it's building rose 30%. Both companies beat Wall Street forecasts.

"There's a need for shelter, because there have been so many delays in housing demand," said

Michelle Meyer

, deputy head of U.S. economics at Bank of America Merrill Lynch, referring to the big drops in wages and household formation that followed the 2008 financial crisis. "It does make the case that there's capacity for faster growth."

Yet, seven years after  the historic bust that led to $7 trillion in lost paper wealth, the emerging housing market has its own anomalies and challenges that investors have to watch out for.

"People would like to buy, but they don't make enough money," said  Alex Barron, president of the El Paso, Tex.-based Housing Research Center, a stock-research firm. "The American Dream isn't dead, but it's not what it used to be.''

Millions more families are still renting rather than buying their housing, even though renting is more expensive than buying, on average. That is until mortgage rates, now hovering around 4%, reach 6% annually for 30-year fixed-rate loans, says Brad McMillan, chief investment officer at Commonwealth Financial Network.

That's a potential trap for real estate investment trusts like Avalon Bay (AVB) - Get Report that have grown strongly as construction of rental housing came back sooner than home buying. Eventually, people are going to choose paths that are more economically rational. It's not just about preferences, it's also about budget and credit constraints, said IHS economist Stephanie Karol.

In addition, now might be a good time to bail on companies like Silver Bay Realty Trust (SBY) , American Homes 4 Rent (AMH) - Get Report and American Residential Properties (ARPI) whose strategies were built on scooping up foreclosed houses and renting them out to families who didn't have the down payment or the credit to buy, Barron said. Silver Bay has lost about a quarter of its value in the last two years, while American Homes for Rent has dropped 10% since last June.

How can small investors play the halting-but-real improvement?

The builders are probably the most obvious winners, since their improving sales should last for several years. But you do have to watch out for valuation: Stocks in the S&P Homebuilders Select Industry Index are up almost 40% since their 2014 low, and the SPDR Home Builders ETF (XHB) - Get Report commands 19 times earnings, a lot for a cyclical fund. The ETF also includes building supply companies like Owens-Corning (OC) - Get Report and others. Similarly, giant real-estate broker Realogy (RLGY) - Get Report is expected to boost second-quarter earnings per share to 69 cents, from 56 cents a year ago. Yet, the stock is up 28% in the last year already.

"If we have more transactions, whether they're sales or rentals, it will help the suppliers," Meyer said.

Of course, all this is clouded by what might happen if home buyers react badly to tighter money, which stalled out a recovery in housing in 2013. But Karol thinks rising interest rates are a small risk: A dovish Federal Reserve led by Chair Janet Yellen has made clear that it will ease off the brakes quickly, if there's any reprise of the housing hiccup that followed the so-called "taper tantrum."

"Janet Yellen will slow down the pace if she sees it impacting things a lot," Karol said.

This article is commentary by an independent contributor. At the time of publication, the author held no positions in the stocks mentioned.