From Sahih Bukhari (Hadith 2722):
Narrated Rafi` bin Khadij:We used to work on the fields more than the other Ansar, and we used to rent the land (for the yield of a specific portion of it). But sometimes that portion or the rest of the land did not give any yield, so we were forbidden (by the Prophet (ﷺ) ) to follow such a system, but we were allowed to rent the land for money
Reference: Bukhari 2722