The decision is a blow to Mayor Eric Adams, who sought to help the Trump administration expand its immigration crackdown.