Good question. We built a house 25 years ago and insisted on copper throughout all the way to the street. Cost more, but was probably a good idea on multiple fronts.
I actually saw the plumber dig up the mains that ran to my place and it was pex.
I can’t believe the mains themselves could use PEX: if nothing else the pressure would be too high.
HDPE is used extensively in all underground utilities, including but not limited to water, sewer, gas, electric, fiber.
That's why Flint's water system had to be almost completely replaced. Even fixing the pH problem wasn't enough because they turned their pipes into swiss cheese.