The Messenger of Allah (ﷺ) made an agreement with the people of Khaibar to work and cultivate in return for half of the fruits or produce.
Sunan Abi Dawud Book 23, Hadith 83