Margarine was developed in 1869 by Hippolyte Mege-Mouries, a French chemist. He received a U.S. patent in 1873. Napoleon III had offered a prize for a butter substitute for his army and navy, because butter spoiled easily.
Mege-Mouries margarine used mainly beef fat. Later formulations used a combination of animal fats and vegetable oils, and today most margarines use only vegetable oils.
Commercial production began in the U.S. in about 1874, to the horror of the dairy industry. For years many states, especially dairy states, outlawed margarine with yellow coloring. The Federal government and many states also passed heavy taxes on yellow margarine. (Without the yellow coloring, margarine has the unappetizing look of lard).
There were many patents granted for various formulas and manufacturing techniques for margarine in the U.S. beginning in 1871.
In 1877, the state of New York passed a law to tax on 'oleomargarine.' When a court voided a ban on margarine in New York, dairy militants turned their attention to Washington, resulting in Congressional passage of the Margarine Act of 1886.The purpose was to protect dairymen and their product, real butter.
Margarine consumption overtook butter consumption for the first time in 1957 in the U.S. Per capita consumption of butter was 8.3 pounds and margarine was 8.6 pounds.
It was only in 1967 that yellow margarine could be sold in Wisconsin. It was the last state to allow coloring to be added to margarine.
I can remember when I was a kid in New York, my mother would buy pale white margarine in a soft plastic pouch, with an orange dot in the middle. You had to knead the pouch to distribute the color throughout the margarine. The dairy industry was able to have laws passed that prevented manufacturers from coloring the margarine. (The natural color of margarine is white). How things change. Today, most of the large national dairy companies manufacture margarine.