The current environment has been downright awful for mortgage real estate investment trusts (REITs). These companies have a dark cloud over their heads as the Federal Reserve takes actions to rein in inflation. The two biggest mortgage REITs are Annaly Capital (NLY -1.39%) and AGNC Investment (AGNC -1.11%). Which stock is the better buy in this environment? 

Picture of the Federal Reserve building.

Image source: Getty Images.

The Fed is going from friend to foe

The mortgage REIT sector has struggled this year as the Fed prepares to reverse the extraordinary measures it took to stimulate the economy in the early days of the COVID-19 pandemic. It has begun to raise the federal funds rate, or the rate banks charge each other for overnight loans; however, the biggest threat to the mortgage REIT sector is its huge portfolio of mortgage-backed securities the Fed bought over the past two years. The Fed's buying supported the book value per-share numbers for these companies, and as the Fed stops buying, this support has begun to reverse. You can see in the chart below that shares of both companies have stumbled this year:

AGNC Chart

AGNC data by YCharts

AGNC and Annaly are mainly invested in guaranteed mortgage-backed securities

While both companies have struggled, AGNC Investment has a slightly different portfolio from Annaly Capital. AGNC Investment is the classic agency mortgage REIT. It invests heavily in mortgage-backed securities, which are guaranteed by the U.S. government. If you refinanced your mortgage over the past two years, chances are your mortgage ended up in a security held by someone like AGNC Investment. Agency mortgage-backed securities are exactly what the Fed has been buying, although AGNC picks and chooses specific types of mortgage-backed securities that are expected to outperform the plain vanilla securities being bought by the Fed. 

Annaly has more credit risk, which is a better bet in this environment

Annaly Capital also invests in agency mortgage-backed securities, but it also invests in mortgages that are not guaranteed by the U.S. government. It has a credit portfolio that invests in mortgages that fall outside the guidelines for a government guarantee. These loans are often targeted toward professional real estate investors and have almost nothing in common with the subprime loans of the real estate bubble days. 

Mortgage servicing rights go up in value when rates rise

Annaly also has a mortgage-servicing portfolio, and these assets are highly unusual in that they go up in value when interest rates rise. Almost every other financial asset suffers declines in a rising rate environment. A mortgage servicer handles a lot of the administrative duties of managing a mortgage on behalf of the ultimate investor. The servicer collects payments, ensures that investors receive their contractual principal and interest payments, pays the property taxes and escrows, and deals with the borrower if they become delinquent. The servicer receives 0.25% of the mortgage's outstanding balance as a fee for these services. 

When rates are rising, it is less likely that the borrower will refinance the loan (since nobody is going to swap a 4% mortgage for a 6% mortgage), and that means the servicer is expected to receive the fee for a long period. This makes the servicing rights more valuable. 

Both stocks will struggle, but Annaly should suffer less

While Annaly still has a large agency portfolio, its exposure to assets with credit risk make it more exposed to the overall economy and real estate prices. If the economy heads into a recession, Annaly might be worse off than AGNC Investment. That said, the economy is strong, inflation is high, real estate prices are rising, and unemployment is low. This sort of economic environment is more conducive to Annaly's portfolio than AGNC's portfolio. That said, both stocks will struggle in this environment, at least until interest rates stabilize.