You add a line to /etc/hosts and dig ignores it. That is how dig works.
dig is a DNS tool. It talks to a DNS server and never reads the hosts file. Programs on your machine use the system resolver, which follows the order set in /etc/nsswitch.conf. getent goes through that same path:
getent hosts nas.local
getent ahosts example.com
So it shows you what a normal program would get, including entries from /etc/hosts. ahosts lists all the addresses, IPv4 and IPv6, which helps when a site works on one and not the other.
That makes it the right command to settle the argument between dig and your browser. If getent and dig disagree, something local, like the hosts file or another source in nsswitch, is overriding DNS. The caveat: browsers with their own DoH setting skip the system resolver altogether, so even getent can disagree with them.
The hosts file is also the simplest way to block a name on one machine: point it at 0.0.0.0. It has no wildcard support, so every name needs its own line, and that is the moment a DNS filter becomes the better tool.
Further reading: getent manual, On this site: ipconfig /displaydns shows what Windows has cached, On this site: resolvectl flush-caches clears the DNS cache on Linux