The Midrash (15:4) opens the parsha of tzara’as with a mashal. A visitor to the king's palace notices that the king has a dungeon filled with all kinds of torture equipment. The visitor is terrified, but the king reassures his friend that the dungeon is not meant for him – it’s meant for the disobedient slaves. What’s in store for him is eating and drinking and rejoicing. The nimshal: when Klal Yisrael heard the parsha of nega’im, they were terrified. Hashem reassures us that the punishment is meant for the umos ha’olam, but for us, there is only enjoyment and happiness.
What is the Midrash taking about? The halacha is that the dinim of tzara’as only apply to a yisrael, not to a nochri -- exactly the reverse of the mashal!
A Sefas Emes from a 2014 post may help us. The kohein is the paradigm of the ish chessed, so we understand why it is the kohein who goes out to the metzorah after his nega heals and declares him rehabilitated. But the kohein also the one who declares the metzora tamei to begin with. How is that in line with his role of chessed?
Sefas Emes answers that not only is becoming healed a chessed of Hashem, but being afflicted is a chessed as well. Imagine a person who doesn’t feel well and goes to visit the doctor. The doctor runs some tests and tells the person that X or Y is wrong, but it can be treated and cured. That person may think not feeling well and having to go to the doctor is terrible, but imagine if the same person never knew he was sick and never went to the doctor -- an infection or some other problem could just fester inside until it did far more damage and caused far bigger problems than could otherwise be taken care of. The wakeup call that something is wrong may be painful, may be inconvenient, may cause stress, but chasdei Hashem, without a wakeup call to correct problems, we would be far worse off.
Getting an opportunity to mend one’s ways and have a kapparah, even if it takes some work and is painful for a period of time, is something to be thankful for. “V’haya b’or besaro nega tzara’as…” Chazal (Meg 5) tell us that “haya” usually connotes simcha. Even though we are talking about a person who comes down with a terrible affliction of tzara’as, the Torah looks at it through the lens of simcha since this is the path to improvement.
Coming back to the mashal in the Midrash, when the person sees the painful instruments the king has at his disposal and shirks in fear, the king’s reassurance that for him there is only simcha doesn’t mean those instruments will never be used on him. What it means is that when the king has to use those instruments, they will be used only for the sake of rehabilitating the person, stopping him from self-destructive behavior, preventing him from suffering worse in the long run. They will never be used, as the king must sometimes use them against others, simply for punishment or vengeance.