Here is the manual for this hydrant:
Woodford Sanitary Hydrant
Perhaps you're not pulling down on the diverter enough to close it. If that's not it, then the diverter is either damaged or has foreign material in it that is causing it not to seal. Either clean it out or replace it.
You'd probably need a double check valve like a sprinkler system to put a garden hose connection underground.
For the yard hydrant:
Your link says "Frost Proof" which is different than "Freeze resistant". Further your referenced code says " that incorporate a stop and waste feature that drains into the ground". The description for the yard hydrant you ...