The Department of Government Efficiency lost a key legal challenge on Tuesday, dealing a blow to how it will operate.