[(Leviticus 14:2:) "This shall be the law of the leper." Whoever speaks slander against his fellow, leprosy comes upon him. From where do you learn it? From Miriam.] See what is written concerning Miriam (Numbers 12:1): "And Miriam and Aaron spoke against Moses." Therefore (ibid. 12:10): "And Aaron turned toward Miriam, and behold, [Miriam] was leprous as snow." What is written there (Deuteronomy 24:9)? "Remember what the Lord your God did to Miriam." And what did she speak against Moses? She said: Moses took a wife, and he has ceased from being fruitful and multiplying. What did the Holy One, blessed be He, do to them? He revealed Himself to them, and they required immersion, as it is said (Numbers 12:4): "And the Lord spoke suddenly to Moses and to Aaron and to Miriam." What is "suddenly"? That He revealed Himself to them and they required water suddenly. He said to them: And thus you required water, and yet I am speaking with you. Immediately Miriam was stricken with leprosy, as it is said (ibid. 12:10): "And behold, Miriam was leprous as snow." And are these things not a matter of light-and-heavy (kal vahomer)? For if Miriam, who spoke only concerning her brother, who was beloved to her, not in his presence, and intended only to restore him to his wife — [if she was punished] thus, then the one who speaks slander about his fellow, how much more so! What is written above on the matter (Deuteronomy 24:8)? "Take heed in the plague of leprosy." And even Aaron, who was High Priest, the hand of the Holy One, blessed be He, touched him, as it is said (Numbers 12:9): "And the anger of the Lord was kindled against them" — against Aaron and against Miriam. But Aaron was healed immediately, and Miriam after [seven] days, [as it is said] (Numbers 12:15): "And Miriam was shut out [outside the camp] seven days." Thus: "This shall be the law of the leper (metzora)" — the one who brings forth evil (motzi ra) is the one who has found evil (motze ra).
Miriam's Leprosy and the Law of the Slanderer in Tanchuma
Midrash Tanchuma Buber, Metzora 6:1
[זאת תהיה תורת המצורע. מי שהוא מדבר לשון הרע בחבירו הצרעת באה עליו, מנין את למד ממרים], ראה מה כתיב במרים, ותדבר מרים ואהרן במשה (במדבר יב א), לפיכך ויפן אהרן אל מרים והנה [מרים] מצורעת כשלג (שם שם י), מה כתיב שם, זכור את אשר עשה ה' אלהיך למרים (דברים כד ט), ומה דברה במשה, אמרה נטל משה אשה, והוא בטל מפריה ורביה, מה עשה להן הקב"ה, נגלה עליהן, והיו צריכין טבילה, שנאמר ויאמר ה' פתאום אל משה ואל אהרן ואל מרים (במדבר יב ד), מהו פתאום, שנגלה אליהם והיו צריכין למים פתאום, אמר להם וכך היו צריכין למים, ואני מדבר עמכם, מיד לקתה מרים בצרעת, שנאמר והנה מרים מצורעת כשלג (שם שם י), והלא דברים קל וחומר, ומה מרים שלא דברי כי אם באחיה חביבה שלא בפניו, ולא נתכוונה אלא להחזירו לאשתו, כך, המספר לשון הרע על חבירו על אחת כמה וכמה, מה כתיב למעלה מן הענין השמר בנגע הצרעת (דברים כד ח), ואף אהרן שהיה כהן גדול נגעה בו ידו של הקב"ה, שנאמר ויחר אף ה' בם (במדבר יב ט), באהרן ובמרים, אלא שאהרן נתרפא מיד, ומרים לאחר [שבעת] ימים, [שנאמר] ותסגר מרים [מחוץ למחנה] שבעת ימים (במדבר יב טו), הוי זאת תהיה תורת המצורע, המוציא רע שמצא רע.