Why does everything have sugar in it? It isn't just in there because it tastes good. If that were all sugar had to offer, it would be added to far fewer products. As it is, sugar is added to things that aren't like leather, concrete and hand lotion. Why? Because it is hygroscopic.
Hygroscopic things have a special affinity for water. Put them in humid air, and they suck down the available liquid. There are all kinds of hygroscopic materials, including salt, cellulose, and sulfuric acid. None of these materials can be added to cupcakes or hand lotion, as customers would complain.
In commercial snack cakes, sugar keeps absorbing water from the air, making the cake moist and silky-textured. The official word for a substance that does this is a humectant, and sugar is one of the most practical humectants around. Any food that needs to sit around for long periods of time without getting crusty, sugar can help. It also draws moisture into non-food products like lotions and fabrics. Whatever is in danger of drying out, sugar can humidify.
There is, of course, a down side. You've experienced it when you've opened a box of caramels on a humid day, ate a couple, left the top off the box, and came back to find the rest of the caramels a gluey mess. The sugar sucked up the water from the environment, changing the texture of the candy. Sugar's hygroscopic qualities are also why mysterious pools of liquid form around hard candy left out on the counter. Sugar pulled in water until the candy "sweated" and the liquid dribbled into a puddle.
Image: Evan Amos.