Here you see the economics of the situation. Each ship pays $20k to $30k in insurance, which is a good deal less than the cost of armed security.
The insurers rake in a total $400M to $600M, paying out $100M.
Economically, it makes sense to just buy the insurance and pay the ransom.
It also, of course, encourages more pirates to join in, so in the long run is not a viable strategy.
But where’s the fun in THAT ??
Plus, as Kipling noted, once you pay the Danegeld, you never get rid of the Dane. . .