It doesn't really matter how the game figures out whether the ship was pirated, captured or purchased, and the player certainly won't know the mechanism.We could also have the functionality work EXACTLY as you suggest there.
So rather than storing whether a ship was pirated or an honest prize ship, not bothering with that at all.
That would actually be simpler than storing it correctly at the time you get the ship and then using that status later when you try to sell her.
Less fancy as well, but probably more logical and realistic. Perhaps easier for the player to understand as well?
You'll still need somehow to store the fact that a ship was purchased.
One thing to consider is what happens if you take a ship legally under a LoM and then somehow lose the LoM before you sell the ship (e.g. resign from the nation's service, or you're playing "Tales of a Sea Hawk" and have just lost your British LoM when you try to get the golden idol in Bridgetown). The ship was taken legally but you don't have a LoM to show the shipyard owner, who therefore regards the ship as pirated. This may or may not be a desirable feature - it's consistent with my logic above but may annoy a player who thinks he's about to sell a legal prize and then gets accused of piracy...