DNS servers have an additional relation between names and IP addresses. If you are asking some DNS server for NS or MX record (which contains the name) and the server has authoritative information about IP addresses for obtained names, it returns to us additional section in packet (packets) DNS responses and these IP addresses.
In the next section, the authority section is also returned NS records for the domain(and in an additional section can be found appropriate IP addresses to these NS records). The purpose of these two sections is obvious, it saves us a lot of other possible inquiries for IP addresses to all obtained records.
We will ask the DNS server ns.ms.mff.cuni.cz for MX records for the domain ms.mff.cuni.cz with a detailed dump of the result (to simplify have been deleted some uninteresting rows and columns):
;; QUESTION SECTION: ;ms.mff.cuni.cz. MX ;; ANSWER SECTION: ms.mff.cuni.cz. MX 20 smtp2.ms.mff.cuni.cz. ms.mff.cuni.cz. MX 40 smtp1.kolej.mff.cuni.cz. ms.mff.cuni.cz. MX 20 smtp1.ms.mff.cuni.cz. ;; AUTHORITY SECTION: ms.mff.cuni.cz. NS golias.ruk.cuni.cz. ms.mff.cuni.cz. NS ns.ms.mff.cuni.cz. ms.mff.cuni.cz. NS ns.kolej.mff.cuni.cz. ms.mff.cuni.cz. NS sns.ms.mff.cuni.cz. ;; ADDITIONAL SECTION: smtp1.ms.mff.cuni.cz. A 22.214.171.124 smtp2.ms.mff.cuni.cz. A 126.96.36.199 smtp1.kolej.mff.cuni.cz. A 188.8.131.52 smtp1.kolej.mff.cuni.cz. AAAA 2001:718:1e03:a01::4 ns.ms.mff.cuni.cz. A 184.108.40.206 ns.kolej.mff.cuni.cz. A 220.127.116.11 sns.ms.mff.cuni.cz. A 18.104.22.168 golias.ruk.cuni.cz. A 22.214.171.124 ;; SERVER: 126.96.36.199#53(188.8.131.52)
We can see that server really told us all known IP addresses to all names in responses and save to us and himself a lot of further work with other requests.