From the beginning until the 1986 tax reform Social Security was largely a "pay as you go" system where taxes closely matched payouts. The SS trust fund was a rounding error wandering between $20 and $40 billion in total value. After 1986 taxes were increased to "save money for future payouts" and the trust fund's accumulated value climbed to over $2.5 trillion. By law these could only be invested in government bonds, i.e. skimmed off by the rest of government. If these were used to pay off general bonds held by the public then it would be OK. Instead the cash was just spent.
Lots of tables on the trust fund and annual SS spending and receipts in Social Security: The Trust Fund
Only special Government Bonds are allowed to be spent on other govervment programs.