With respect to the NIV, you are asking about what is technically termed a "gloss." A gloss is a portion of scripture which has been or is thought to have been added to the text by scribes and which was not written by the author.
Yet the NKJV is out of character on this verse, seeming to have been partly influenced by the modern versions. It supposedly follows the same line of text from which the KJV was translated, a subset of the Majority Text, also known as the Byzantine text, the Masoretic Text, and the Textus Receptus, or "Received Text"--though this latter name came into existence well after the King James Bible was translated.
The KJV has the text as:
Because it entereth not into his heart, but into the belly, and goeth
out into the draught, purging all meats? (Mark 7:19, KJV)
This follows from the Greek.
ὅτι οὐκ εἰσπορεύεται αὐτοῦ εἰς τὴν καρδίαν ἀλλ᾽ εἰς τὴν κοιλίαν καὶ
εἰς τὸν ἀφεδρῶνα ἐκπορεύεται καθαρίζον πάντα τὰ βρώματα (Mark 7:19,
Greek)
That Greek would be literally translated something like this:
Because not it enters of him into the heart but into the belly and into the latrine goes out, purifying (him) all the food.
The Greek word for "purifying" here is in a masculine declension, whereas the Greek word for "food" is neuter. This means that to translate the sentence as the food being purified is actually grammatically problematic. The noun should agree with the verb. Because both "heart" (καρδίαν/cardian) and "belly" (κοιλίαν/koilian) are feminine, they cannot be the subjects of this verb either. "Sewer" or "latrine" is masculine, but it is in the accusative, making it an object. This leaves only one possible subject for this verb in the verse: "he/him," whose antecedent of "man" (ἄνθρωπον/anthropon) is found in the preceding verse. In other words, it should say that the man is cleaned (of) all the food at the toilet.
Conclusion
Both the NKJV and the NIV have improper translations of this verse. While neither version reflects Mark's intent, the NKJV at least indicates that the words should be attributed to Jesus. The NIV translation includes the gloss--words which Jesus did not say, nor which were written by Mark. Those words should have been left in a marginal note, if included at all.