Purple sweets are a reward from all levels of Treasure Trails, though higher level Treasure Trails yield greater amounts at a time. When the player eats one, they receive the message: The sugary goodness heals some energy. or The sugary goodness is yummy. It heals 20% energy per sweet eaten, and also heals 200 life points. Since they are stackable, they are an option if inventory space is needed for food instead of energy potions, although they have a high price per bite and a low heal rate.
Purple sweets are a quest reward from the quest Carnillean Rising. Upon completion of the quest, you can look in the chest for your reward which may include 5 purple sweets.
With the release of the Fight Kiln, purple sweets rose from 8,000 to 23,000 coins in two weeks. After the hype of the event died down, the price quickly declined to pre-release prices.
Purple sweets are different than sweets, a non-tradeable item from the 2005 Hallowe'en event. These sweets disappeared after the 2005 event, even if they were stored in a bank.
Since the sweets can stack, they heal the most life points per inventory slot, limited only by the amount the player has and the 2,147,483,647 limit of items you can have. 2,147,483,647 purple sweets means you can heal: 429,496,729,400 (429 billion) life points. It would also take 1,556,925,644,075 coins until a player can buy the maximum stack of sweets (at the current price). Assuming all sweets are bought on the Grand Exchange, it would take approximately 979 years to buy a maximum stack of them.
It was once possible to use these sweets to effectively make a character invincible. Players who came to know it often used it against Tz-Tok-Jad. Prior to the constitution update, the amount of damage done to a player was calculated before the attack actually hit, and was limited to a players remaining life points. Meaning if a player had just 10 LP left, an attack could only do a maximum of 10 damage, and this damage was calculated before the attack landed. Players would eat sweets just prior to being hit, to boost their life points to (e.g.) 30, but the attack would still only do 10 damage.
In the quest Gertrude's Cat, when asked what he wanted in return for information on Fluffs, Gertrude's sons Shilop and Wilough complain about how expensive "sweets" are compared to chocolate.