These stocks thrived during past inflationary periods and are primed to do so again

The Nike logo is seen on the Nike store on February 22, 2021 in New York City.
John Smith | Corbis News | Getty Images

With April's scorching inflation report, investors may want to consider the companies that are best prepared for higher prices.

The closely-watched consumer price index report was released on Wednesday, showing price acceleration not seen since 2008. CPI spiked 4.2% from a year ago, compared to the Dow Jones estimate for a 3.6% increase.

Excluding volatile food and energy prices, the core CPI increased 3% from the same period in 2020, compared to estimates of 2.3%.

There are a confluence of catalysts for higher inflation right now: an economic reopening, $1.9 trillion more fiscal stimulus and a Federal Reserve willing to let the economy run hot. Inflation can change the way people invest because price pressures erode investors' capital, make companies' future profits less valuable and could push interest rates higher.

Bank of America analyzed periods of past significant inflation and the impact on markets.

The two most recent periods were from November 2003 to September 2006 and October 2010 to January 2012. The firm found that the S&P 500 had an annualized return of about 9% during those periods.

CNBC Pro found the stocks that beat the market during those two inflationary periods. 

Berkshire Hathaway Live Event