The word 'ransom' never appears in holy scripture, as such.
There is a word lutron which occurs twice, both times used by Jesus who, both times, precedes it by the word anti which is not the same as our English prefix 'anti'. The Greek anti conveys 'in correspondence to' not 'against' or 'in opposition to'.
The best analogy I have ever come across is the concept of prosecution and defence in a court of law. Not as to adversarial law, combating in court with oratory. But in a proper court where prosecution and defence are setting out the two corresponding sets of real evidence.
A type of mirror image but not (as mirror images are not) identical.
So, Jesus twice says anti lutron.
... the Son of man came ... to give his life a ransom for many. [Matthew 20:28, KJV]
... the Son of man came ... to give his life a ransom for many. [Mark 10:45, KJV]
In both cases Jesus says lutron anti, that is to say a lutron in correspondence of many.
The basis of lutron is luo, which does not mean 'loose' as many seem to think. The concept is very broad and covers such things as John being unworthy to remove his shoes, Jesus dismissing a crowd after preaching and the act of breaking the sabbath.
My understanding of the broad concept is the concept of 'dispossession'. 'Loosing' or delivering' is, sometimes, involved but in the context of redemption it is important to realise that what is in view is lawful dispossession.
In the book of Ruth this is set forth by Ruth and Boaz and the inheritance. Boaz gathers elders in the gate and publicly buys both the field and takes 'possession' of Ruth (in the sense of taking responsibility for her and her problem of inheritance which requires a marriage).
The whole is a matter of lawful dispossession (the man with one shoe is dispossessed) and Boaz takes proper and lawful possession and responsibility.
Paul takes up the words used by Jesus and he makes it into one word antilutron :
... Christ Jesus who gave himself a ransom for all [I Timothy 2:6 KJV]
Here, Paul speaks of the correspondence of Jesus' life in accordance with (or, in behalf of, it is huper) that humanity which is under his headship. The 'all', in context, refers to that for which he mediates.
Jesus previously spoke of the Son of man being a lutron corresponding to 'many'.
These three references are all that are in scripture, that are commonly translated 'ransom'.
Lutron belongs to a family of words : luo, apoluo, lusis, lutrosis and apolutrosis which, together convey the concept of redemption.
I can find no justification, myself for using the English word 'ransom' in this case. A ransom, after all is a bribe, no more and no less. One bribes a kidnapper to accept money in exchange for releasing the kidnapped.
This is not a proper and lawful dispossession.
If one examines all the scriptures concerned there is not a single case in which the concept of the kidnapped being 'ransomed' occurs. And many get into trouble with trying to figure who the ransom is paid to. Some imagine slaves being auctioned in the 'marketplace' but the fact is that the Agora is not a marketplace.
The Agora is more of a Bourse. It is the public area in which public transactions are lawfully carried out before witnesses. Such as buying land. Or such as probate after a decease. See, again, Boaz in the gate with the elders, carrying out a lawful transaction before trusted witnesses.
These concepts have traditionally been muddled. And the muddle is not helpful to competent, intelligent understanding of concept.
I suggest that lutron conveys 'the means of deliverance'. It is that which 'corresponds' to the necessary dispossession of the item in question. Someone has possession of an item and their possession of it is quite lawful. They did not steal it. They did not kidnap. Their possession of it is quite proper in the eyes of the law.
The Redeemer must lawfully and properly :
1 dispossess the owner of the item - negate their lawful possession of it
2 secure the item in their own possession
3 provide a permanent place of safety to ensure no further loss
These three aspects, together, constitute redemption as it is set forth in scripture.
It is an extensive subject and also brings in the agora- words agorazo and exagorazo.
Which would require another question.