Inflation is generally difficult for stock investors because it pushes up interest rates, negatively impacting the present value of future earnings. In many industries, rising inflation is felt through increased input and labor costs; in some cases, companies can try to pass on these costs. However, consumers have the final say, and if they won't pay higher prices, margins will suffer.

In inflationary periods, as a general rule, real estate and commodities tend to outperform. The key to succeeding in an inflationary environment is finding companies that can control costs while still benefiting from rising prices. Here are three real estate investment trusts (REITs) whose cost structures will be less impacted by inflation but benefit from rising prices.

High lumber prices and a potential homebuilding boom

Weyerhaeuser (WY -0.54%) is a timber REIT that owns or manages almost 25 million acres of timberlands throughout North America. Lumber prices have been on a wild ride over the past several years, starting with rapid rises during the COVID-19 pandemic. Lumber prices have fallen back but are still elevated compared to pre-pandemic levels. Weyerhaeuser is one of the biggest manufacturers of structural lumber, oriented strand board, and plywood. Its customers are primarily in the residential construction business.

While rising home prices and mortgage rates have negatively affected affordability, there remains a shortage of housing in the U.S. that must be built. According to the National Association of Realtors, there is a deficit of 5.5 to 6.8 million housing units, which dwarfs our typical housing completions of around 1.5 million. This deficit will get filled one way or another, and Weyerhaeuser will supply the materials. As long as lumber prices hold up and demand remains strong, Weyerhaeuser investors should benefit from rising inflation.

A red-hot housing market

Continuing on the housing-shortage theme, American Homes 4 Rent (AMH 1.07%) is a residential REIT that purchases single-family residences and rents them out. It generally focuses on purchasing properties in areas with strong job growth and limited housing supply. As home prices rise, rents will rise in tandem. Rising home prices also help the company by increasing the value of its portfolio, although this value is "hidden" and won't be realized unless the company sells its properties.

American Homes 4 Rent is another stock whose costs will not increase at the same rate as inflation. Of course, costs will increase if it purchases homes at elevated prices. However, most of American Homes 4 Rent's portfolio was purchased in 2015. In addition, the company will sell properties if it can get good prices for them. While labor and maintenance costs will rise with inflation, its borrowings are mainly fixed rates, so rising rates won't be much of an issue. This is another REIT with a revenue and cost mismatch when it comes to inflation.

Massive margins

American Tower (AMT -0.59%) is a cellphone REIT that leases capacity on its towers to cellphone companies, cable companies, and governments. It will benefit from the increased use of mobile data, which will only grow as more applications requiring 5G capacity are released. According to one study, global mobile data usage will increase by a factor of 4.2 between the end of 2021 and 2027.

Given that most of its infrastructure has already been built, it will be somewhat insulated from inflation on the cost side. Of course, the company is still making capital expenditures for the rollout of 5G; however, the company's operating costs should increase at a slower rate. Most of American Tower's debt is fixed rate, meaning it has modest exposure to rising interest rates, and some of that risk has been hedged via interest rate swaps.

American Tower has massive margins. The company's adjusted funds from operations (AFFO) last year came in at $4.3 billion on $9.4 billion in revenues. Funds from operations are typically used to describe REIT earnings since non-cash depreciation and amortization charges tend to be high for real estate companies. But American Tower's huge margins mean that the company should still be highly profitable even if costs go up.