Railroad took security very seriously as a miscreant moving a switch on the tracks could result in huge damage or loss of life. Additionally, railroads used locks to secure their own facilities, supplies, cars, tools, and other valuables, not to mention the valuable freight being shipped by the express companies, or others moving goods around the country.
The most valuable locks are heart-shaped locks that were used to secure switches, the early locks were cast from brass with sometimes ornate logos or patterns which can bring hundreds and even thousands of dollars in some cases. A lock does not need a key to be valuable, but it is important that it has the original undamaged key cover, that the shackle is not damaged or frozen, marks and lettering are visible and not overly worn, and that the patina has not been cleaned or polished. Most collectors place a huge value on the patina of a railroad lock and if it is cleaned and polished it can greatly destroy the value.