Ransom can mean two things:
- Holding a person against their will, in order to get some money (or some other things)
- The money, or the goods which (could possibly) be obtained in such a way.
If people talk about that they need to pay money to the state or the police, to get free, the correct legal term used is usually bail.
Often in piracy, pirates would steal something or someone important and demand a ransom payment.