Shares of the companies that mine or make raw materials are lately trading like once-hot technology stocks. The S&P 500’s materials sector is up around 5.4% this month, even as the broader index has fallen more than 4%.