Why Silver "Ranks" Gold
At the start of the American Revolution, officers in the Continental Army wore no rank insignia; it soon became apparent that some means of identifying the officers was required. As an expedient, field officers were ordered to wear red cockades on their hats, captains wore yellow or buff and lieutenants were provided with cockades of green.
In 1782 Washington implemented a system where epaulettes would be worn by officers as indicators of rank: major generals wore epaulettes with two stars on each shoulder, brigadier generals epaulettes with one star on each shoulder, field graders a plain gold epaulette on each shoulder, captains wore a single epaulette on the right shoulder, and subalterns wore one on the left.
In 1821 this practice was abolished in favor of using chevrons to denote rank. Chevrons for officer rank did not last long (except at West Point, where they're still used today to designate cadet officer rank), and in 1832 epaulettes came back. (This was also when the spread eagle was adopted as the insignia for full colonels.) Infantry officers wore silver epaulettes; all others wore gold. For example, an infantry colonel wore a gold eagle on his silver epaulette, and all other colonels wore silver eagles on gold.
In 1836 the shoulder strap replaced the epaulette on field uniforms. It had a border of silver or gold depending on the color of the epaulette it replaced. The leaf and bars appeared at this time, but the colors were not fixedofficers wore gold insignia on silver-bordered shoulder straps and vice versa. In 1851 all epaulettes and shoulder strap borders became gold and the insignia on the epaulettes were silver. Majors and second lieutenants wore no rank insigniathey were distinguished only by the type of fringe on their epaulettes. Rank insignia on shoulder straps were silver for all officers down to and including lieutenant colonels; captains and first lieutenants wore gold insignia.
When epaulettes were abolished in 1872 and replaced with shoulder knots which had no fringe, it was necessary to devise some insignia to distinguish the majors from second lieutenants. So the gold leaf was adopted to denote majors, and that's why lieutenant colonels wear silver leaves and majors gold. At the same time the color of the bars for junior officers was changed to silver. The second lieutenant still wore no insignia, and was only distinguished by the shoulder strap or knot.
Finally, in 1917 the second lieutenant got some "respect" and the Army decided to adopt a new insignia for him. The plan called for the least disruption to other rank insignia, so it was decided to follow the color precedent established in devising major's insignia and adopt the gold bar for the second lieutenant.