They renamed the US Digital Services agency to be DOGE. I don't know if they can rename a branch of government but that's how they are doing it. Musk has then gotten Trump to appoint members of his initial DOGE as representatives in each of the departments (Treasury, Commerce, etc) so they can have acting authority.
Trump's delegated Musk as a Special Government Operative and signed executive orders granting him and all his recommended employees security clearances w/o the requisite background checks that normally would be required.
So they are acting within the government, they are employees, and they've been granted special waivers by Trump to do all this craziness.
I think its going to come down more to the courts looking at whether these 'newly appointed employees' are breaking all kinds of laws passed by congress.