From Sahih Bukhari (Hadith 2512):
Narrated Abu Huraira:Allah's Messenger (ﷺ) said, "The mortgaged animal can be used for riding as long as it is fed and the milk of the milch animal can be drunk according to what one spends on it. The one who rides the animal or drinks its milk should provide the expenditures
Reference: Bukhari 2512