[Another interpretation:] "Do not cut off the tribe of the families of the Kohathite" (Numbers 4:18). The Holy One, blessed be He, foresaw that Korah was destined to arise and dispute over the priesthood. The Holy One, blessed be He, said: We will not destroy the Levites on account of Korah. "Do not cut off" — this is what Scripture says: "For the sake of My name I will defer My anger, and for My praise I will restrain Myself toward you, so as not to cut you off" (Isaiah 48:9). To what is the matter comparable? To a king who had a son, and he became attached to the bandits, and they were seized, and his son was seized together with them. The king said: What shall I do? If I kill the bandits, it is possible that my son is among them; rather, for my son's sake I release them now. So too the Levites were bearing the Tabernacle, as it is said: "But to the sons of Kohath he gave none, because the service of the holy things was upon them; they were to carry on the shoulder" (Numbers 7:9). And the Holy One, blessed be He, was looking upon Korah and his company, who were destined to dispute against Moses and Aaron. The Holy One, blessed be He, said: What shall I do to these? To kill them is impossible. Why? Because the Holy One, blessed be He, took half of His name and placed upon "the Kohathite" the YH. Therefore He says: "For the sake of My name I will defer My anger" etc., "so as not to cut you off."
Why God Spared the Kohathites Despite Korah's Rebellion
Midrash Tanchuma Buber, Bamidbar 30:1
[ד"א] אל תכריתו את שבט משפחות הקהתי. צפה הקב"ה שקרח עתיד לעמוד ולחלוק על הכהונה, אמר הקב"ה לא בשביל קרח נאבד את הלוים. אל תכריתו, זש"ה למען שמי אאריך אפי ותהלתי אחטם לך לבלתי הכריתך (ישעיה מח ט), למה הדבר דומה, למלך שהיה לו בן ונדבק עם הליסטים, ונתפשו ונתפש בנו עמהם, אמר המלך מה אעשה אהרוג את הליסטים אפשר בני עמהם, אלא בשביל בני אני פונה אותם עכשיו, כך היו הלוים נושאים את המשכן, שנאמר (ובני) [ולבני] קהת לא נתן [כי עבודת הקדש עליהם בכתף ישאו] (במדבר ז ט), והיה הקב"ה מביט בקרח ובעדתו שעתידין לחלוק על משה ואהרן, אמר הקב"ה מה אעשה לאלו, להרוג אותם אי אפשר, למה שנטל הקב"ה חצי שמו ונתן עליו י"ה הקהתי, לפיכך הוא אומר למען שמי אאריך אפי וגו' לבלתי הכריתך.