An answer on another SE site mentions that sugar "at a certain level acts as a preservative". I've always been taught that microorganisms eat sugar and expel acids, that is why sugary food are damaging to teeth. How is it that sugar acts as a preservative, then?
Sugar in high concentrations acts osmotic. This means that the water available in the cells is drawn towards the high concentration of a solutant (sugar), like in the image below (this is demonstrated with a plant cell, but the principle is the same for bacteria and other microorganisms):
Since microorganisms can not survive without water, they are not able to grow or reproduce. This effectively safes food. The same mechanism works when salt is used to conserve meat or fish.