It's a tax, so they can take part of the money and do other things with it. And they have from time to time. They are not remitting the full tax receipts to the Social Security Administration for disbursement. Which instead of having them buy US debt, actually creates the need to create more US debt because they have obligations to meet and the SSA is locked into certain debt instruments that can't be exited on large scale easily.
EDIT: This is not correct. It appears they have borrowed against the SS fund using treasuries, which will have to be back. Or phrased another way - the SS system chose to invest in US debt.