Bank of America said in a note that the stock index could rise over the next year if June's Consumer Price Index reading marked peak inflation.

Consumer price inflation fell to an annual rate of 8.5% in July from 9.1% in June.

The S&P 500 usually rallies during periods of rising inflation.

The S&P 500 saw an average upside of 16.8% and a median of 19.1% in the year after an inflation peak, according to historical data.

If inflation peaked below 6.3%, there would be an average upside of just 0.05% and a median of 0.1%.

The surge in the year-on-year consumer price index in June was frightful, but the rallies from the peaks of the index can be enjoyable.

The timing of those gains depends on whether or not inflation peaked in June. The June level of 9.1% is not a trend according to analysts.

BofA's analysts don't think the Fed is as far behind the curve as it was a year ago, because the spread on the 2-10 Treasury yield curve has tightened.

The bank said that the 10-year Treasury yield has been coming down and that it may signal less volatility in the future.