Pinging localhost versus pinging 127.0.0.1

Solution 1:

Hostnames can resolve to both IPv4 and IPv6 addresses. "localhost" resolves to IPv4 (127.0.0.1) and IPv6 (::1).

I think Windows' preference is to use IPv6 where possible, which is why localhost defaults to the IPv6 resolution. If you turned off IPv6 it would go to the IPv4 address.

The reason you dont encounter this much when pinging internet servers is that many ISPs don't provide customers with IPv6 addresses (and many routers/modems can't handle them), and you need all devices in a chain to use IPv6 if you want to reach a server using IPv6.