The judge accused the Justice Department of using its investigatory powers to retaliate against state officials for not cooperating with federal efforts to crack down on illegal immigration.