It is narrated from Hazrat Ibn Abbas (may Allah be pleased with them both) with reference to Ubayy bin Ka'b (may Allah be pleased with him) that the Holy Prophet (peace and blessings be upon him), quoting these words of Hazrat Musa (peace be upon him), said: "If you had wished, you could have taken a wage for it."
Hadith Referenceمسند احمد / مسند الأنصار رضي الله عنهم / 21115