Sahih Muslim, Book 6, Hadith 324 (Muslim 1879)

'Abdullah b. Mas'ud reported Allah's Messenger (ﷺ) as saying:

There should be no envy but only in case of two persons: one having been endowed with wealth and power to spend it in the cause of Truth, and (the other) who has been endowed with wisdom and he decides cases with the help of it and teaches it (to others).