It has reached me that the Messenger of Allah ﷺ said, "Injuries caused by mines incur no liability, injuries caused by livestock incur no liability, and injuries caused by wells incur no liability. On buried treasure, a fifth is due."
حدثنا محمد بن جعفر قال حدثنا عوف
بلغني أن رسول الله ﷺ قال المعدن جبار والعجماء جبار والبئر جبار وفي الركاز الخمس
Its isnad is sahih, but it is mursal, and he will connect it in the following hadith. It has already occurred at 7690, 9820, and their cross-references.