Despite all the doom and gloom that abounds in the residential and commercial real estate markets, homebuilders and REIT stocks have been two of the best-performing sectors this year, with both beating the

S&P 500's

dismal decline.

A possible windfall tax benefit to U.S. homebuilders, along with massive covering by short-sellers, is propelling the sector of late. REITs have also been benefiting from a short-covering rally that was probably overdue, since the sector has been

punished too hard

on fears of a commercial property meltdown.

However, investors should be careful about blindly buying either sector today. While there has been some positive news for both camps, the stocks are getting rather rich values. The high volatility of these sectors can also make for painful corrections and false rallies at times.

Through Friday's close, the

SPDR S&P Homebuilders

(XHB) - Get Report

ETF is up 23% in 2008, compared with a 6.7% decline in the S&P 500. The U.S. MSCI REIT Index is up 6.8% for the year.

Last week, Congress agreed to work on a bill that would offer tax refunds by allowing homebuilders to carry back recent losses to profits in the prior five years. While this provides some nice short-term cash flow help, there remain several question marks about the future earnings power of the sector.

Tax Break Won't Boost Builders

var config = new Array(); config<BRACKET>"videoId"</BRACKET> = 1485890899; config<BRACKET>"playerTag"</BRACKET> = "TSCM Embedded Video Player"; config<BRACKET>"autoStart"</BRACKET> = false; config<BRACKET>"preloadBackColor"</BRACKET> = "#FFFFFF"; config<BRACKET>"useOverlayMenu"</BRACKET> = "false"; config<BRACKET>"width"</BRACKET> = 265; config<BRACKET>"height"</BRACKET> = 255; config<BRACKET>"playerId"</BRACKET> = 1243645856; createExperience(config, 8);

One issue that remains is the effect of land-impairment charges. The sale by homebuilder

Centex

(CTX)

this week of land at

20 cents on the dollar

suggests that builders continue to have inflated land prices on their books. Centex's stock, meanwhile, is trading right around book value -- so why would one buy the stock at this level, since the recent fire sale indicates book value needs to be impaired further?

Price-to-earnings metrics look even worse for builders. Take

D.R. Horton

(DHI) - Get Report

, for example. JMP analyst Jim Wilson upgraded Horton to strong buy recently, and he says the the firm can earn 50 cents a share in 2009. With the stock at around $17, that equates to a forward P/E of 34.

"Why buy at that multiple unless you think EPS will grow 25% to 30% annually after 2009?" says an analyst, who didn't want to be named, at a hedge fund that has bearish positions in Horton.

One question investors want answered regards how much of the recent builder rally is due to longer-term bullish positions being opened rather than simply short-term covering by short-sellers.

Lennar

(LEN) - Get Report

and

KB Home

(KBH) - Get Report

both made it clear in their recent earnings calls that their homebuilding business got worse in the first quarter.

Sources who are negative on the sector blame newbie investors for jumping the gun and buying the builders too early. Bullish parties are citing the fact that builder stocks soared before the end of the 1991 recession.

However, this time around one thing is clearly different about the U.S. housing market: the direction of future mortgage rates.

The 30-year mortgage rate topped at around 10% in the 1990-1991 recession and then fell to 7% by 1993. This time around, 30-year mortgage rates are already at around 6%, and nobody is expecting rates to drop any further and provide a massive tailwind to the building industry.

Investors who are tempted to buy the builder stocks today should make sure they understand that stock charts don't tell all of the story.

Also among the better performers of late have been REITs that own apartment buildings. To some degree this makes sense, since many pockets of the U.S. are still exhibiting strong rental growth, despite the weak economy.

Essex Property Trust

(ESS) - Get Report

has been benefiting from very strong rental growth rates in Northern California and Seattle -- where the single housing markets are not that weak and the local economies are rather strong. The company's Southern California portfolio faces a possible fallout from layoffs at

Countrywide

( CFC) and

Amgen

(AMGN) - Get Report

.

Nonetheless, Essex's stock is up 22% for the year, as investors have decided that the company probably offers one of the safer cash-flow growth stories in apartment stocks currently.

Essex, at around $118, is now trading at a rich 19 times next year's funds from operations, a common REIT performance metric that adds back depreciation to earnings per share. Analysts expect 7% FFO growth this year. The stock's 3.5% dividend yield makes it worth a look, but better value could be had if you can buy the stock on a pullback.

Green Street Advisors, which rates Essex a hold, says the net asset value -- the private market value of Essex's real estate portfolio -- is $126 per share.

Essex and other apartment owners are also benefiting from the help of easy financing from

Fannie Mae

( FNM) and

Freddie Mac

( FRE).

At the annual New York University REIT Symposium in Manhattan last week,

Home Properties

(HME)

CEO Edward Pettinella said that both Fannie and Freddie are currently offering five-year and 10-year mortgages for apartment buildings at 5% and 5.7% respectively, which is down from 5.4% to 6% a year ago.

Fannie and Freddie provide financing at rates that are a spread over five-year and 10-year Treasury notes. While spreads are up from year ago, the Treasury rates are down.

Such low financing is helping apartment REITs avoid the credit squeeze that is hurting much of the commercial property sector because of the effective shutdown of the commercial mortgage-backed securities market.

With Fannie and Freddie around, apartment REITs don't need to worry about the fact the Wall Street banks are currently offering much higher financing rates for the rest of the REIT industry.

So while an economic downturn will hurt rental demand, apartment stocks and their fundamentals may not end up getting beaten down as much as some investors are assuming.