For decades, the military made sure soldiers had access to the treat—including spending $1 million on a floating ice-cream factory.