he shall dwell isolated
Many commentators have noted the similarities that exist between the requirements of a metzora, as outlined here, and those that apply to a mourner. Both must rend their garments and allow their hair to grow (compare Lev. 10:6 and 21:10), and just as a metzora must live in isolation outside his city, a mourner is confined to his home.
At the same time, however, there is one crucial difference between the two observances. In the case of a metzora, there is a requirement of בָּדָד יֵשֵׁב , the metzora must live in solitude and not engage in any form of social activity. According to some views, a metzora may not even reside together with other metzora’im. The metzora is ostracized from the community. When a person observes aveilus, however, although he must remain in his home, he is not barred from social contact. To the contrary, the community is obligated to care for and visit the mourner, to ensure that he is not left to deal with his loss on his own.
There is another significant difference between a mourner and a metzora. Mourning observances are suspended on Yom Tov, because, as the Gemara (Moed Katan 14b) explains, the public festival celebration overrides the private, personal obligations of mourning. A metzora, by contrast, is not permitted to reenter his city or go to Jerusalem to offer the festival sacrifices; in this case, the public mitzvah of the holiday celebration does not override the individual’s personal restrictions.
These distinctions are related. The nature of the Yom Tov festivity is amidah lifnei Hashem – standing before the Almighty. It is the experience of being in God’s presence that triggers the obligation of simchah on the festivals. Although a mourner on a personal level feels distant from God as a result of his loss and the trauma he endures, he is nevertheless part of Am Yisrael who collectively experience the joy of amidah lifnei Hashem. The public festivity overrides his personal restrictions.
The metzorah is excluded from the community and is likewise distanced from the Mikdash. As such, he cannot experience amidah lifnei Hashem, and must therefore continue his observance of the tzara’as restrictions even on Yom Tov. (Shiurim Le-zekher Abba Mari, vol. 2, pp. 192-194, Koschitzky Virtual Beit Medrash).