Ransom and redemption are the same word wearing different clothes.
Etymonline traces ransom to Middle English raunsoun in the 13th century, a sum paid to free a prisoner or captive. English took it from Old French ranson, which goes back to Latin redemptionem. That noun comes from the verb redimere, "to buy back," built from red-, "back," and emere, "to buy" or "take."
Redemption reached English by a different route from the same Latin noun. Words that share a source but arrive separately are called doublets, and Etymonline lists ransom and redemption as one.
The two words also share a double life. Etymonline notes that ransom carried a religious sense as well, deliverance from damnation. The idea of a debt paid to set someone free stretched easily between a prisoner in a cell and a soul in trouble.
The verb followed in the early 14th century, meaning to buy back something by paying what was demanded.
The final -m is a small puzzle. Etymonline says the spelling with -m appeared by the late 14th century, but its origin is unclear. It compares the shift from -n to -m to seldom and random. So the sound change is real, though the reason it happened in this word is not settled.
Ransom was serious business in the Middle Ages, because captured people carried a price. The best-known case is Richard I of England, seized on his way home from the Third Crusade and handed to the emperor Henry VI. His release in 1194 cost, in the royal.uk biography's words, a "crushing ransom of 150,000 marks of silver."
Phrase Finder says "a king's ransom" began as the real price of freeing a captured king. It also records the figurative drift early: a text printed in 1525 already called something worth "a kyngis ransoun," with no king involved.