In the original culture it was paying a nominal fee to the government to register a person as a free man or woman; much the same thing had to be done for freeing a slave, too.
Obviously the basic concept also works for our usual meaning of ransom, where a wealthy person – often the family head or possibly the patron of another family – pays an enemy to set free a captured prisoner. That happened a lot more back then than now, of course, and the ancients were aware of the implications because they often imagined Christ’s descent into hades as a sneak attack along this line, offering Himself as ransom to the devil to free prisoners held by the devil. And then NUKING THE HELL OUT OF HELL once Satan let Him in.
Theologically that didn’t comport with any kind of high theology (much less with any kind of high Christology), so the poetry changed over to the idea of Christ outright raiding hades instead of tricking Satan into letting Him in. It also didn’t fit scriptural imagery, including occasional mention of the descent into hades, which has nothing to say of Christ having to trick Satan into letting Him in, nor of there being a barter arrangement of Christ for us. But some of the imagery (including, for what it’s worth, in the incident of Christ announcing the sin against the Holy Spirit to the Pharisees) does fit the idea of a military raid on a bandit-chief’s fortress to free prisoners. Paying the cost for such a raid, like Abraham putting together a coalition of allies to go rescue Lot (one of whom was the king of Sodom, by the way!), could also be considered paying a ransom cost: the cost for raising up someone enslaved to freedom.
I suspect there was also some kind of connection, in the terminological usage, between raising someone to freedom/maturity, and resurrection out from the dead-ones into eonian life.
Anyway, the situation Paul is talking about in Galatians 4 isn’t anything so drastic or colorful. The father is only making a nominal payment as a public symbol of his committed recognition that his child is ready to take on family responsibilities and representations (in marriage, politics, business, etc.)
However, sooner or later the allotment of the inheritance would go a lot farther than a nominal public gesture, namely once the father dies. You’ll probably have heard this is a big underlying theme Westerners are likely to miss behind the parable of the prodigal son: the younger son is demanding that the father go the full distance now in dividing up the inheritance, as though he has already died. Horribly, horribly insulting, and only made worse by how irresponsibly the younger son behaves afterward – not with mature responsibility like the older son. Part of the radical reversal surprise of the parable (as you’ve likely read already ), is that Mediterranean and Ancient Near Middle Eastern cultures would have been primed to be 100% on the side of the older son, disappointingly shocked at how his father out of gratuitous love for the younger son is willing to dishonor himself – and then the older son hits back with BLATANT FREAKING LIES about how stingy his father has been toward him all this time.
Granted, there’s no overt ‘ransom’ payment in that parable – except perhaps in the father voluntarily paying extreme personal dishonor without a qualm in order to love both his ungrateful sons. But the normal cultural ‘ransom’ of children would be standing behind the story details: the father raises up his sons to the status of family representatives, and then deals with their culturally (and spiritually) horrifying ingratitudes, manifested in different ways. He would have been perfectly within his rights to have both of them slain, or worse, except of course in the parable he has voluntarily given up all his rights in a culturally simulated death. What the father is more concerned about than the dignity of his rights, is true justice: the reconciliation of the brothers to each other, and to himself, and the proper maturity of both children.
Jesus could have told the parable in such a way that the father leads the elder son in a raid to rescue the younger son and to smite the hell out of the son’s abusive master – and Jesus does tell a parable rather like that during the unforgiveable sin incident! – but He had other ideas He wanted to emphasize there.
(Me being me, however, waaaay back in my early days as a Christian universalist I rejiggered this and several other parables into that eschatological situation, as an exercise. Not sure I ever posted that here…)