Ibn Mas’ud (May Allah be pleased with him) reported: Messenger of Allah (ﷺ) said,(Which means): “Hasad (here it means: strong desire to do the same) is permitted only in two cases: A man whom Allah gives wealth, and he disposes of it rightfully, and a man to whom Allah gives knowledge which he applies and teaches it.”[Al-Bukhari and Muslim].

وعن عبد الله بن مسعود رضي الله عنه قال‏:‏ قال رسول الله صلى الله عليه وسلم ‏:‏ “ لا حسد إلا فى اثنتين ‏:‏ رجل آتاه الله مالاً ، فسلطه على هلكته فى الحق، ورجل آتاه الله حكمة فهو يقضي بها ويعلمها” ‏(‏‏(‏متفق عليه