Oh I see, it seems this is about the common misconception of what ground is, rather than how transformers work.
In order for current to flow, there needs to be a complete circuit. Any electrons coming out of the negative terminal of a battery, must go back into the positive. The same is true for the transformer, except the direction of the current flow is continuously changing.
Another interesting fact is that within a closed circuit, the net charge remains constant. When a capacitor discharges through a resistor, the number of electrons and thus charge in the entire system doesn't actually change. All that happens is electrons are transferred from the negative plate of the capacitor, to the positive plate, via the resistor. The number of electrons inside the capacitor stays the same.
Ground is just a reference point, from where all voltages are measured. It makes no sense to measure the voltage between a stake in the ground and a floating transformer secondary. All you'll read is a ghost voltage, leaking through the transformer's inter-winding capacitance. The primary coil is acting as one plate of the capacitor with the neutral of the mains connected to the soil and the secondary is the other plate of the capacitor. If the voltage source powering the transformer was to be completely isolated from earth, which is actually impossible, as there will always be some capacitive coupling, then you'd read zero between earth and any part of the circuit, because no current would flow.