What's the difference for a hosts file when deciding to use 127.0.0.1 or 0.0.0.0?

127.0.0.1 is localhost, by listening only to that address you can ensure that it is not at risk for being connected from outside the machine, which is good for security.

The ANY address 0.0.0.0 is used by the system to accept connections to any local address.

This does not mean that 0.0.0.0 matches any address, it is just a special case. When listening.

In terms of hosts file 0.0.0.0 makes no sense.