The Prophet ﷺ said, "Harm caused by livestock is not compensated, injuries occurring in a well are not compensated, and accidents in a mine are not compensated. And on buried treasure, a fifth is due."
حدثنا بهز حدثنا حماد عن محمد
عن النبي ﷺ قال العجماء جبار والبئر جبار والمعدن جبار وفي الركاز الخمس
Its isnad is sahih. It was previously mentioned at 7690. Bukhari narrated it, 2/160, in zakat, in the section on treasure troves, one-fifth, and Muslim narrated it, 3/1334, number 1710, in the section on legal punishments, injuries caused by animals and mines.