Halacha reflects not only legal truths, but moral, psychological, and philosophical (and other) truths, as well. The wide observance of the laws of mourning--one of the major themes of Masechet Moed Katan--is likely due more to the psychological comfort it offers than to the legal requirements mourning entails.
When one buries a relative hours before Yom Tov, the halacha requires that all mourning cease with the advent of the chag, a most difficult, perhaps impossible emotional challenge. While the heart may still be grieving, the halacha requires that the sadness of the individual give way to the joy of the community. Halacha recognizes that, at times, the heart and the hand, our minds and our actions, are not always on the same plane; yet the hand must still act. Thus, the family of a convicted murderer does not sit shiva upon his execution--such would be incongruous with the mitzvah to rid ourselves of evil. In a brilliant move, our Sages ordained that the “mourners” approach the judges who sentenced their loved one to death, telling them that they have nothing against them. This, presumably, may or may not actually be true; but even if not, sometimes a white lie is a good thing. Yet at the same time, the Mishnah allows and expects these families to be grieving, and while they may not outwardly mourn, they may grieve, as “grieving is only in the heart” (Sanhedrin 45b).
Even more difficult for mourners is the case when a relative dies during the festival and mourning is delayed until the conclusion of the festival. There is a time for everything, and Yom Tov is not the time for mourning. Jewish law demands that man learn to master his emotions, something that takes (at least) a lifetime of work. At times, the individual must sacrifice for the community--while, at other times, the community must sacrifice for the individual[1].
Of course, we are not machines; and man, by his very nature, is often torn between conflicting emotions. With amazing insight, our Sages ordained that when one inherits a large sum of money upon the death of a parent, one recites both the blessing of dayan haemet, accepting the judgment of G-d, and a shehecheyanu of thanksgiving for one's newfound wealth. They well understood the complexity of emotions. (See here for a short discussion of this fascinating set of laws.)
“And Rav Meir also said: One may gather the bones of his father and mother [and re-inter] them, because it is joy for him. Rabbi Yossi says it is mourning for him” (Moed Katan 8a). With our belief in the eternity of the soul, and the holiness of the body that housed that soul, a burial place is of great significance. In Talmudic times, it was common to bury someone in a temporary grave without a coffin, allowing for quick decomposition of the body. At the proper time, the bones would be placed in a coffin and buried in the family plot. Such re-interment surely aroused mixed emotions.
On the one hand, there is joy at having the deceased rest in peace in his ancestral plot. And for Rav Meir, this is reason enough to allow, and perhaps even encourage, re-interment on Chol Hamoed--a time of joy. On the other hand, burying a parent--even, perhaps especially, in their final resting place--is most difficult and emotionally draining. Memories rush to the surface, and this is the focus for Rav Yossi in forbidding such on Chol Hamoed.
The Gemara seems to accept Rav Yossi’s view, quoting a teaching from Masechet Smachot[2] that “one who gathers the bones of his father and mother, behold, he is to mourn for them for one day”. Re-interring a parent brings too many sad emotions to the surface, and is inappropriate for Chol Hamoed. Abaye, in defending the view of Rav Meir, explains that the joy of the festival is so powerful and engaging that the feelings of melancholy remain suppressed even during re-interment. One may thus do so on Chol Hamoed, and skip the day of mourning. Jewish law accepts the view of Rav Yossi.
The need to separate a focus on death from the holiday season is doubly reinforced with the next teaching of the Mishnah, that one may not eulogize the dead from thirty days before the festival. The 3rd century Babylonian sage Shmuel explains that, “the dead is not forgotten from the heart for thirty days”, so that hearing a eulogy even a month before Yom Tov will put a damper on the holiday. It is thus best to forego the eulogy. Amazing!
This was too much for some, and the Rav--Shmuel’s contemporary and frequent debater--has a more...shall we say, practical (or hard-nosed) reason. His concern--based on what he had witnessed--is that many were liable to pay an exorbitant sum of money for a professional eulogizer, leaving little money for the festival. A volunteer would thus be allowed to eulogize before the festival. Unfortunately, Rav’s concern still exists, as all too often (primarily in the non-observant part of our community) people pay huge and unnecessary fees for funerals. Yes, we must honour the dead, but better to honour the living.
[1] The most prominent example being that a community must be willing to sacrifice itself rather than actually hand over somebody to an enemy.
[2] Masechet Smachot is a collection of rabbinic teachings dealing with the laws of mourning. In keeping with the Torah’s avoidance of negative words wherever possible, this non-Talmudic “tractate” goes by the euphemistic name "Joys".