Yep. They bought the property and everything on the property. The gold was as much a part of the deal as the tree was.
Amusingly, the Bible has almost the exact set of events as an example of how ownership should be decided...with the exception that likely the couple didn’t know of the coins prior to purchasing the property.