Sold machinery weapons, is there a way to get them back?

Short answer: You cant get them back until you start another game, whether NG+ or otherwise. Personal notes below are in italics below the section header.

From to the Official Deluxe Ed. Guide (p.202-p.207):

Upgraded by Cid

Only the machinery can be sold with none of them can be bought back after being sold. None of the melee weapons in this list can be purchased in a store, only found or acquired during a quest / side-quest.

These weapons are carried over to NG+ in their current state at game conclusion with the exception of Ultima Blade, which reverts to Engine Blade III. However, all weapons carried over also duplicate in NG+ as if they were never acquired and can be re-upgraded and then sold allowing the player to sell and keep the weapon at the same time:

  1. Engine Blade > Engine Blade II > Engine Blade III > Ultima Blade
  2. Force Stealer > Force Stealer II
  3. Drain Lance > Drain Lance II > Drain Lance III
  4. Plunderers > Plunderers II
  5. Valiant > Valiant II
  6. Absorb Shield > Absorb Shield II
  7. Auto Crossbow > Auto Crossbow Plus
  8. Bioblaster > Biolblaster Plus
  9. Circular Saw > Circular Saw Plus
  10. Noiseblaster > Noiseblaster Plus
  11. Drillbreaker > Drillbreaker Plus

Collectible Only

These can be sold but not bought (there are collectible weapons that can also be bought, but the below list cannot) If you sell them, they're gone (sorry).

  1. Balmung (sword)
  2. Enhancer (sword)
  3. Duel Code (greatsword)
  4. Iron Duke (greatsword)
  5. Dominator (greatsword)
  6. Apocolypse (greatsword)
  7. Dragon Lance (polearm)
  8. Flayer (polearm)
  9. Ulric's Kukris (daggers)
  10. Organyx (daggers)
  11. Vigilantes (daggers)
  12. Executioner (firearm)
  13. Hyper Magnum (firearm)
  14. Death Penalty (firearm)
  15. Wizard Shield (shield)
  16. Aegis Shield (shield)
  17. Ziedrich (shield)

Pre-Order Bonus Only

These cannot bought or sold, do carry into NG+, and do not duplicate.

  1. Mage Mashers (daggers)
  2. Gae Bolg (polearm)
  3. Masamune (greatsword)
  4. Blazefire Saber (sword)

All other weapons can be purchased, sold, and repurchased.