It was narrated from Abdullah bin Masud that the Messenger of Allah (May Allah bless him and grant him peace) said:
“There is no (permissible) envy except in two cases: A man whom Allah has given wealth and caused him to dispose of it in a proper manner, and a man to whom Allah has given wisdom, and he acts in accordance with it and teaches it (to others).”