Some companies did offer benefits to their town, for roughly the same reason the FAANGs offer free lunches and dinners. Kind of a double edge gift.
I have no idea where the "companies used to take care of their employees" commenters are coming from. There's plenty of counterexamples.
"The toxicity of concentrated TEL was recognized early on, as lead had been recognized since the 19th century as a dangerous substance that could cause lead poisoning. In 1924, a public controversy arose over the "loony gas", after five[94] workers died, and many others were severely injured, in Standard Oil refineries in New Jersey.[95] There had also been a private controversy for two years prior to this controversy; several public health experts, including Alice Hamilton and Yandell Henderson, engaged Midgley and Kettering with letters warning of the dangers to public health.[17] After the death of the workers, dozens of newspapers reported on the issue.[96] The New York Times editorialized in 1924 that the deaths should not interfere with the production of more powerful fuel.[17]" (https://en.wikipedia.org/wiki/Tetraethyllead#Initial_controv...)
See also radium, polyvinyl chloride, assorted mine disasters, etc.