Retail investors are buying the dip in energy stocks even as recession fears and concern over waning demand send the group tumbling, according to data from Bank of America. Energy is still the only S & P 500 sector in the green this year, with a gain of roughly 32%. But the industry is more than 20% below the multiyear high it hit on June 8. The downturn follows a related decline in oil prices. West Texas Intermediate crude futures, the U.S. oil benchmark, are down more than 10% in July and on pace for the worst month of 2022. Part of the recent weakness is due to concern that should the global economy continue to slow, excess demand for oil and petroleum products will dry up. Still, for the year WTI has advanced 27% as the market reacted to tight supplies and the revived demand following Covid-19 lockdowns. Despite the recent weakness in energy stocks, retail investors are flocking to the space. Bank of America said Tuesday that over the last two weeks, buying of energy stocks by the firm's retail clients has been close to record levels. Analysts led by Jill Carey Hall noted that the weekly net buying during that span is the third- and fourth-largest weekly purchases in the firm's data going back to 2008. Bank of America added that in inflows into specific energy stocks has outpaced money going to energy exchange-traded funds. Separate data from Vanda Research, which also tracks activity from retail investors, provides an insight into what exactly is being bought. Occidental was the most-purchased stock, at $190.7 million worth of shares. Exxon and Devon followed at $177.3 million and $65.6 million, respectively. "Retail investors have remained steady buyers through the recent decline of the sector," said Lucas Mantle, data science analyst at Vanda Research. However, he noted that the buying is still significantly below purchase activity in February and March when "the rally in energy names saw retail investors become strong buyers across the sector." - CNBC's Michael Bloom contributed reporting.