Pirates sanctioned by the government? Sounds like something manga invented. But the One Piece fact is, most of the real pirates you know were actually privateers–pirates sanctioned by the government. Henry Morgan (the guy on the rum bottle) was one, Blackbeard began his career as one, and the famous Sir Francis Drake were all, basically, Shichibukai.
Privateers were pirates the government hired to attack, loot, and plunder other countries’ ships. And they were very good at it. The epic Whitebeard war, where the Shichibukai fought alongside the Marines–that stuff actually happened. Privateers were often more skilled at naval warfare than the actual navy, and were called into battle to defend the mother country in times of need. A few captains eventually became admirals themselves. Just imagine, Admiral Don Flamingo.
Remember how during the war Blackbeard, a Shichibukai, betrayed the government? Well, that was real too. Some privateers, like the real Blackbeard, backstabbed the government and decided to attack, loot, and plunder whoever they wanted. In fact, many privateer captains were voted out of their position by their crews because they wouldn’t attack their own countries ships. I suppose it just doesn’t pay to be loyal.