As far as I understand the federal reserve is not technically part of the government but a private institution. It has shareholders not unlike a public company and those shareholders are the big banks like JPM. I'm not sure if those are the same as the so called primary dealers or if there is just an overlap. You are correct that the actual printing of physical cash is done by the government on behalf of the fed, I think by the treasury.