How can a buried terminal have different potential than earth potential?
By convention, the mass of the Earth is at a potential of 0 volts.

Your assumption is incorrect - the ground is not an insulator.  Soil contains water and dissolved mineral salts and so conducts electricity.  Wet soil with organic material can be a relatively good conductor, but dry stony or sandy soil has a much higher resistivity.

Once you start treating the Earth as a giant spherical resistor, it all makes more sense.  If you hammer a ground stake into the Earth, well away from any other electrics, you get a good 0V reference point.

However, if you start passing current through the ground, then the voltage rises at one terminal, and falls at the other.