|James Stewart as Ransom Stoddard,|
Lee Marvin as Liberty Valance
Ransom Stoddard - An educated man from back East, Ransom hopes to bring law and order to the West. He favors statehood as a way to protect settlers from unscrupulous ranchers.
Bad guy Liberty's name sounds positive, but the "liberty" he represents is unrestrained and unmediated freedom. Valance acts on his every whim and impulse, however violent, provided it doesn't interfere with his own liberty, regardless of how it affects others.
One of the definitions for "ransom" given by Merriam-Webster is "to deliver especially from sin or its penalty." Ransom Stoddard certainly provides (at least by appearances) a deliverance from evil (evil in the form of Valance), but also represents the "captivity" (to use words suggested by "ransom" or "holding ransom") of the freedoms we yield to the law in order to sustain a peaceful society. The killing of Liberty by Ransom (albeit in perception only) is symbolic of this giving up of unrestrained personal freedom for the common good.
See also: Great Showdowns: The Man Who Shot Liberty Valance