The use of the term in U.S. politics began in the late 19th century to describe instances of elected officials directing public funds to their constituencies through legislation as a means of winning the favor of those they represent. The use of the term expanded in the 19th century, particularly to the Congressional appropriations process and the use of earmarks.
The term is thought to derive generally from the association with pork barrels, a means of storing salt pork, a staple foodstuff for sailors, soldiers, and citizens alike, throughout the 17th, 18th, and 19th centuries. Salting pork was an effective method of preservation before the invention of refrigeration and could be kept for an indefinite period when stored properly.
In its early usage, “dipping into the pork barrel” came to mean appropriating funding from the federal budget. Beyond its more general association between stores of food and stores of money, the term may have also come from the practice of American slave owners distributing salted pork to slaves as a reward.