The Messenger of Allah ﷺ said, "There is no envy except in two cases. A man whom Allah has given wealth and empowered to spend it in the cause of truth, and a man whom Allah has granted wisdom, by which he judges and which he teaches to others."
حدثنا محمد بن عبد الله بن نمير حدثنا أبي ومحمد ابن بشر قالا حدثنا إسمعيل بن أبي خالد عن قيس بن أبي حازم
قال رسول الله ﷺ لا حسد إلا في اثنتين رجل آتاه الله مالا فسلطه على هلكته في الحق ورجل آتاه الله حكمة فهو يقضي بها ويعلمها
Bukhari narrated it in the Book of Knowledge, Chapter: The Delight in Knowledge and Wisdom, no. 73, from the hadith of Ismail through him, and Muslim in the Prayer of Travelers, Chapter: The Merit of One Who Recites the Quran and Teaches It and the Merit of One Who Learns Wisdom, etc., no. 816, from Ibn Numayr through him.