Crafted from Dreamstone, an extinct mineral, it was made to destroy the Mammon Machine. Once plunged into the head of the machine, the resulting skew of energy transformed the knife into the legendary Masamune. Likely to revive the blade, it was infused with the spirits of Masa & Mune, who protect the sword later in Denadoro Mountains. Oddly enough, in Magus' flashback of the Mammon Machine's destruction, neither the Masamune nor the Ruby Knife (nor any other blade) is depicted as having been stabbed into the machine. This oddity implies that Melchior was not exiled from Zeal in this timeline (that is, before Crono and company intervened) and thus had enough time to complete the blade to its mature form.
Trivia
The Masamune is the only Equippable blade to not cause an attack or defense alteration when battling the Mammon Machine. It also absorbs and heals only Frog after every attack. Many believe this is because the Masamune originated from the Ruby Knife.