Gold's been money before states were invented. It's not that the government's established gold as money, it's more like gold gave the government's credibility for their currencies. Even after they moved away from it, central banks until today still hold a lot of gold reserves.