One man’s pirate is another man’s privateer. At that time if you were wealthy enough to afford a warship you were also wealthy enough to get Britain, Spain ,France or the fledgling USA to rubber stamp your papers. Some privateers even switched sides with who would pay them more what a grand time to be alive except for the lack of antibiotics and air conditioning....
It’s true, especially if you were fighting your country’s enemies but you still needed the letter of marque to make it legal to do so in defense of your country.
Captain Kidd was a privateer - but hanged as a pirate. His papers were signed by the King of England, but the King disavowed that he had made a contract with Kidd. A very interesting and detailed history of Kidd in the book “The Pirate Hunter” by Richard Zacks.