Outsized inflation is generally bad for stocks because it prompts the Federal Reserve to raise interest rates, and higher rates have a tendency to cause the economy to slow. That said, not all stocks react the same way to inflation.

One quite visible sign of this effect on stocks is in relation to how inflation affects commodity prices. As inflation rises, commodity producers will outperform commodity users. Take oil for example: In a rising oil market, the drillers will probably benefit while the airlines will probably suffer.

A home with a "for rent" sign in front.

Image source: Getty Images.

In an inflationary environment, housing often outperforms. During the high-inflation 1970s, the median home price rose from $23,900 to $63,700, which works out to be over a 10% annual return. The S&P 500 total return index averaged 5.8% per year during the same decade.

If we are heading into an inflationary environment, then real estate is a good place to look for investing ideas. Here are two inflation-resistant stocks to consider.

1. American Homes 4 Rent has a large portfolio of rapidly appreciating properties

American Homes 4 Rent (AMH -0.61%) is a single-family rental real estate investment trust (REIT). The company owns 56,077 single-family homes and rents them out. Rents generally correlate with home price appreciation as you can see from the chart below, which tracks median asking rent versus median home prices. So, if home prices are rising, rents move up pretty much in lockstep. 

US Median Asking Rent Chart

US Median Asking Rent data by YCharts

Home prices have been appreciating at 18.5% over the past year, which has been driven by housing shortages. The National Association of Realtors estimates there has been an "underbuilding gap" of 5.5 million to 6.8 million homes since 2001. To put that number into perspective, housing starts have been running at a 1.5 million unit annual pace, which represents about four years' worth of production. Demographics are driving the shortage as well, as many first-time homebuyers are bidding against each other to acquire starter homes. 

For companies like American Homes 4 Rent, real estate appreciation doesn't show up in the earnings numbers until the properties are sold, however, the company does sell properties as they become expensive. The housing shortage will probably continue to be an issue as shortages of skilled labor and materials limit how many homes the builders can put out. American Homes 4 Rent is one way for investors to gain exposure to the rental market without having to buy and manage a property. 

2. Equity Residential caters to affluent urban renters

As a general rule, wages usually keep up with inflation, especially for workers with in-demand skills. Equity Residential (EQR -0.56%) is another housing REIT, but it focuses on luxury apartments for young, high-earning professionals. Equity Residential develops high-end apartment buildings in places like Boston, Southern California, New York City, Seattle, Denver, and Washington, D.C. These cities are knowledge centers and contain many young, affluent residents. 

While most REITs were negatively affected by COVID-19, Equity Residential's tenant base of knowledge workers was less affected. Many of these workers are in the science, technology, engineering, and mathematics (STEM) fields. These workers were able to transition to remote work and keep their jobs. The pandemic did negatively affect the company as tenants had a brief period of negotiating leverage as people fled urban areas. This translated into lower rental appreciation than normal, however, those leases are expiring and will be reset to higher levels

Most of Equity Residential's markets are highly housing-constrained, with expensive single-family properties and limited development possibilities. Home prices have been appreciating at a healthy clip and rents should move up in tandem. Since STEM fields are in high demand, wages will keep up with rising prices, which means tenants will be able to afford the increases. Equity Residential will be more inflation-resistant than most.