The ruling could deprive the Justice Department of its most important leverage in extracting concessions from local officials, the threat of prosecution.