Another interpretation (of Ecclesiastes 9:2): "As with the good" — this refers to the sons of Aaron. "As with the sinner" — these are those who quarreled against Aaron, Korah and his congregation, who were burned, as it is said, "And a fire went out from the LORD" (Numbers 16:35). And the sons of Aaron entered to offer, and "a fire went out from before the LORD and consumed them" (Leviticus 10:2). These offer and are burned, and those offer and are burned. And Solomon cried out, "As with the good, so with the sinner." When the sons of Aaron were burned, he sat and complained, saying: What sin befell my sons that such was done to them? Immediately the Holy One, blessed be He, revealed Himself to Moses and said to him: Go, comfort him. From where do we learn this? That it is thus written, "after the death of the two sons of Aaron" (Leviticus 16:1). And what did He say to him? "Speak to Aaron your brother," etc. (Leviticus 16:2). And "speaking" (dibbur) is nothing other than consolation, as you say, "Speak to the heart of Jerusalem," etc. (Isaiah 40:2).
Why the Righteous Sons of Aaron Died Like Korah's Rebels
Midrash Tanchuma Buber, Achrei Mot 1:2
ד"א כטוב, זה בניו של אהרן. כחוטא, אלו אותם שחלקו על אהרן קרח ועדתו ונשרפו, שנאמר ואש יצאה מאת ה' (במדבר טז לה), ובניו של אהרן נכנסו להקריב ותצא אש מלפניה' ותאכל אותם (ויקרא י ב), אלו מקריבין ונשרפין, ואלו מקריבין ונשרפין, ושלמה צווח כטוב כחוטא, כיון שנשרפו בניו של אהרן היה יושב ומתרעם, לומר מה חטא אירע לבני שכך נעשה להם, מיד נגלה הקב"ה על משה, וא"ל לך נחמו מנין שכן כתיב אחרי מות שני בני אהרן, ומה א"ל דבר אל אהרן אחיך וגו' (ויקרא טז ב), ואין דבור אלא ניחומים, כד"א דברו על לב ירושלים וגו' (ישעיה מ ב).