As @Rivkin pointed out, it was done through kinzoganmei, shumei, and sometimes even inscribed as mei when the shortening was done by a smith - and this was hardly a guarantee of authenticity as handwriting, kao etc. can be faked just as easily (perhaps more easily) than NBTHK papers.
Some things to consider:
Even kinzogan, shumei and actual mei are subject to decay, especially as it's still mostly considered taboo to oil or otherwise preserve the nakago. There are many swords papered by the NBTHK with a signature or attribution that is no longer legible.
Attributions can, and do, change frequently as scholarship in the field advances - and that's excluding all the known cases where nefarious intent was involved. Appraisers' trustworthiness can fall into disrepute, and even the NBTHK itself had to invalidate an entire series of papers (Kicho and Tokubetsu Kicho) due to corruption in the branch offices. If those had been inscribed directly on the nakago, that's now permanent damage to a historical artifact that cannot be undone; at best, covered up or crushed.
These are not just historical artifacts but in many cases, works of art with national significance. Imagine suggesting that museums place an official stamp on a Van Gogh or chiseled into a Rodin as proof of its authenticity, should the item be stolen. Can you anticipate what objections to this might arise?
In the end, as time, knowledge and researching techniques advance, the same holds true for nihonto as with any other form of art and historical artifact: the work has to speak for itself.
EDIT: there are, however, some technological solutions that may become available. For example, something similar to an anti-theft ID dot with microscopic details or miniature RFID chip with identifying information affixed to the end of a nakago in a non-destructive manner is something that may become feasible in the future.