You sure about the M&M's thing? That sounds a bit too much like the Fisher Space Pen myth.
IIRC, Hershey's did get money to figure out how to prevent chocolate bars from melting in higher temperatures so they could be included in rations for soldiers heading to warmer climates, like in the Pacific or Northern Africa, though. You sure you're not mixing those two up?