Buying Sweets on Mawlid al-Nabi: Permissible?
Question

Is it haram to eat the special sweets made for the occasion of the Prophet’s Birthday, a day before or after or on the same day? What is the ruling on buying these sweets, especially that these types of sweets are related only to this occasion?
Praise be to Allah.Celebrating Mawlid al-Nabi: Allowed?
Celebrating Mawlid al-Nabi (Prophet Muhammad’s birthday) is bid’ah (an innovation). It is not narrated from the Prophet (peace and blessings of Allah be upon him) or any of his Companions or the Tabi’in or the Imams. Rather it was innovated by the ‘Ubaydis (Fatimids), who also introduced other innovations and misguidance. 
The fact that this celebration is an innovation has been discussed in the answers to questions no. 10070 and 70317 . 
Buying sweets on Mawlid al-Nabi
The basic principle is that it is permissible to eat and drink sweets that are free of harmful ingredients, so long as that is not helping in evil or propagating or encouraging its survival. 
It seems that buying Mawlid sweets at the time of that celebration comes under the heading of helping and propagating it; rather it is a kind of establishing that festival or ‘eid, because an ‘eid is something that people observe regularly. 
If it is their custom to eat this specific food or they make it for that festival, unlike their habits at other times of the year, then buying and selling it, and eating it or giving it as a gift, on that day, is part of celebrating that festival or establishing it. So it is better for you not to do that on the day of the celebration.  
In Fatawa al-Lajnah ad-Daimah, there is a discussion about Valentine’s Day and buying sweets that have been coloured red and on which hearts are drawn, as an expression of celebrating that innovated festival. It says: 
“The clear evidence from the Quran and Sunnah – on which there is consensus among the early generations of the ummah – that there are only two ‘Eids or festivals in Islam: ‘Eid al-Fitr and ‘Eid al-Adha. 
Any festivals other than these, whether they are connected to a person, a group, an incident or anything else, are innovated festivals. And it is not permissible for the Muslims to celebrate them or approve of them, express joy on them or help with them in any way. This is because all of that is transgressing the sacred limits of Allah, and whoever transgresses the sacred limits of Allah has wronged himself. 
It is also haram for a Muslim to help with this festival or any other haram festivals in any way, whether it has to do with food, drink, selling, buying, manufacturing, giving, corresponding, announcing or anything else. This is because all of that is cooperating in sin and transgression and disobedience to Allah and to the Messenger of Allah, (peace and blessings of Allah be upon him). Allah says (interpretation of the meaning):
“Help you one another in Al-Birr and At-Taqwa (virtue, righteousness and piety); but do not help one another in sin and transgression. And fear Allah. Verily, Allah is Severe in punishment.” [al-Maidah 5:2]” 
For other issues related to Mawlid al-Nabi, please see these answers: 249 , 20889 , 137931 , and 13810 .
And Allah knows best.