He traced it back to the Prophet ﷺ, "Excess water must not be withheld in order to prevent others from grazing the surrounding pasture."Sufyan explained, "There is pasture around your well, so if you withhold your excess water from people, they will not be able to come and let their animals graze."
حدثنا سفيان عن أبي الزناد عن الأعرج
يبلغ به النبي ﷺ لا يمنع فضل الماء ليمنع به الكلأ قال سفيان يكون حول بئرك الكلأ فتمنعهم فضل مائك فلا يعودون أن يدعوا
Its isnad is sahih. Malik related it in Muwatta 744, from Abu Zinad, from Araj. Bukhari related it in 42:5 and 12:296, and Muslim in 1:460, both by way of Malik. Muslim also related it with similar wording, through other routes. See what has already passed in the Musnad of Abdullah bin Amr bin As, 7057.