A federal appeals court blasted California’s law that tried to shut down immigration detention centers paid for by the federal government but run by private contractors, ruling Monday that the state was illegally attempting to override the national government’s policies.