To suggest we never appeased the Barbary Coast states, and simply sent the Navy and Marines to the shores of Tripoli and kicked ass, is both too simple an explanation, and plain wrong history.
Actually, the US paid a whole hell of a lot of appeasement money, called 'tribute' back then, to the Barbary Coast pirates, well before the US Navy existed, and well before we had a single ship either on the ways or afloat.
Many US citizens languished in Barbary Coast jails/dungeons/hellholes, until the US Congress approved ransom money, which was carried and delivered to the Barbary pashas and their servitors.
The idea of 'we don't negotiate with terrorists' is not only a recent one, but many times in the past negotiation with what we would now call terrorists or terrorist states led to better outcomes for those imprisoned or threatened by them, compared to head-on force, or compared to ignoring the enslavements.
Many thousands of Europeans enslaved by the pirates were also freed through ransom payments from their respective countries, and from special groups organized to free white European slaves.
According to Wiki, it was the French conquest of Algiers in 1830 that finally put an end to all the Barbary depredations.
Wiki:
"The Barbary threat led directly to the creation of the United States Navy in March 1794. While the United States managed to secure peace treaties, these obliged it to pay tribute for protection from attack. Payments in ransom and tribute to the Barbary states amounted to 20% of United States government annual expenditures in 1800.[21] The First Barbary War in 1801 and the Second Barbary War in 1815 led to more favorable peace terms ending the payment of tribute. However, Algiers broke the 1805 peace treaty after only two years, and subsequently refused to implement the 1815 treaty until compelled to do so by Britain in 1816."
One of the most readable books that closely tracks the young US Navy and the Barbary Coast states is 'A Short History of the United States Navy'. It is long out of print but not too hard to find cheap at internet used book stores. It's treatment of the War of 1812 and the Civil War is also clear and concise and enjoyable. It has been digitized and made available free at the Library of Congress here:
https://archive.org/details/shorthistoryofun01clar
Many Europeans, Dutch and others, joined up with the Barbary Pirates to introduce them to modern shipbuilding and ship handling. They intended for the Barbary Coast pirates to expand out into the Atlantic and attack enemies of those mainlanders, which they did. Not too different from the way the US and the Soviets provided modern war tools to both Iran and Iraq, hoping for certain outcomes favorable to each big power.
Now back the Mosconi cup, go USA!
If we don't learn from history we are doomed to repeat it, or something like that.