All perfect praise be to Allaah, the Lord of the worlds. I testify that there is none worthy of worship except Allaah and that Muhammad, sallallaahu ‘alayhi wa sallam, is His slave and Messenger.
It is impermissible for a Muslim to put edible substances in such repulsive places because food is a blessing from Allaah, the Exalted, that should be respected and honored. Moreover, such an act is done by wasteful people who are dispraised by Allaah, the Exalted. Allaah, the Exalted, has made adornment permissible and even commanded us to seek adornment and beautification and rebuked those who deemed it forbidden. He says (what means):
• {O children of Adam, take your adornment at every masjid, and eat and drink, but be not excessive. Indeed, He likes not those who commit excess.} [Quran 7:31]
• {Say, "Who has forbidden the adornment of Allaah which He has produced for His servants and the good [lawful] things of provision?"} [Quran 7:32]
However, one should seek adornment within reasonable limits; moderation should be observed, as clarified in the verse, since moderation is the nature of Islam. Allaah, the Exalted, says (what means): {And do not spend wastefully. Indeed, the wasteful are brothers of the devils, and ever has Satan been to his Lord ungrateful.} [Quran 17: 26-27]
Using edible substances in such a way as mentioned in the question reflects excessiveness and extravagance. In addition, it obviously implies disrespecting and dishonoring food. Although seeking adornment and beautification is a legitimate interest, as we have clarified, it is still a transient and secondary interest. One can use other substances instead of edible ones unless the aim is to treat certain diseases and that using such substances is essential for treatment. In this case, there is a major principle in Islamic jurisprudence that states that "in cases of legitimate necessity, forbidden things are considered permissible." A Muslim should remember those who suffer from starvation and cannot find even bread to keep them alive. One may send this food over to such poor people through charitable organizations that are widespread all over the world. It is not proper for a Muslim to think about such excessiveness and extravagance while knowing these people's difficult conditions.
Allaah Knows best.