Trick-or-treating may well have originated in the old custom of “souling,” as people went from house to house, begging (“mumming”) for “soul cakes,” actually prayers — in sweet form. Sir James George Frazer wrote about this practice in The Golden Bough: a Study in Magic and Religion, a classic in anthropology, first published in 1890:
In Bruges, Dinant, and other towns of Belgium holy candles burn all night in the houses on the Eve of All Souls, and the bells toll till midnight, or even till morning. People, too, often set lighted candles on the graves. At Scherpenheuvel the houses are illuminated, and the people walk in procession carrying lighted candles in their hands. A very common custom in Belgium is to eat ” soul-cakes” or ” soul-bread ” on the eve or the day of All Souls. The eating of them is believed to benefit the dead in some way. Perhaps originally, as among the Esquimaux of Alaska to this day, the ghosts were thought to enter into the bodies of their relatives and so to share the victuals which the survivors consumed. Similarly at festivals in honour of the dead in Northern India it is customary to feed Brahmans, and the food which these holy men partake of is believed to pass to the deceased and to refresh their languid spirits.3 The same idea of eating and drinking by proxy may perhaps partly explain many other funeral feasts. Be that as it may, at Dixmude and elsewhere in
Belgium they say that you deliver a soul from Purgatory for every cake you eat. At Antwerp they give a local colour to the soul-cakes by baking them with plenty of saffron, the deep yellow tinge being suggestive of the flames of Purgatory. People in Antwerp at the same season are careful not to slam doors or windows for fear of hurting the ghosts.