The justices sided with Michigan officials, who have raised environmental alarms and pushed to decommission an aging section of the pipeline.