Sayyiduna Ibn Umar (may Allah be pleased with them both) narrated that the Prophet Muhammad (peace and blessings be upon him) said: "Envy is justified only in two cases: one, a person whom Allah has given the Qur'an and he recites it day and night; and the other, a person whom Allah has given wealth and he spends it day and night."
Hadith Referenceاللؤلؤ والمرجان / كتاب صلاة المسافرين وقصرها / 466
Hadith Gradingمحدثین:«صحیح»
Hadith Takhrij«صحیح، أخرجه البخاري في: 97 كتاب التوحيد: 45 باب قول النبي صلی اللہ علیہ وسلم رجل آتاه الله القرآن فهو يقوم به»
Sayyiduna Abdullah bin Mas’ud (may Allah be pleased with him) narrates that the Messenger of Allah (peace and blessings be upon him) said: Envy (desire to be like someone) is permitted only in two cases. One is the person whom Allah has given wealth, and he has the ability to spend that wealth in the way of truth; and the other is the person whom Allah has granted wisdom (knowledge), and he judges by it and teaches it (to the people).
Hadith Referenceاللؤلؤ والمرجان / كتاب صلاة المسافرين وقصرها / 467
Hadith Gradingمحدثین:«صحیح»
Hadith Takhrij«صحیح، أخرجه البخاري في: 3 كتاب العلم: 15 باب الاغتباط في العلم والحكمة»