Briefly, the government can give you a digital copy of your driver's license or passport or whatever that can be bound to a hardware security key you have. Most modern smartphones have a suitable security key built.
To verify your age for a site a zero-knowledge proof (ZKP) can be constructed for the site to prove that you have that document, it says your age is above the threshold needed for the site, and that you have the hardware key it is bound to, and you were able to unlock that hardware key. Nothing else is revealed to the site.
Note that once the government issues that digital ID bound to your security key they are out of the picture. They have no idea what you use that ID for or when you use it.
Google has released an open source library to help with this kind of system, discussed here [1].