The Supreme Court on Wednesday struck down part of a federal anti-corruption law that makes it a crime for state and local officials to take gifts valued at more than $5,000 from a donor who had previously been awarded lucrative contracts or other government benefits thanks to the efforts of the official.

By a 6-3 vote, the justices overturned the conviction of a former Indiana mayor who asked for and took a $13,000 payment from the owners of a local truck dealership after he helped them win $1.1 million in city contracts for the purchase of garbage trucks.

In ruling for the former mayor, the justices drew a distinction between bribery, which requires proof of an illegal deal, and a gratuity that can be a gift or a reward for a past favor. They said the officials may be charged and prosecuted for bribery, but not for taking money for past favors if there was no proof of an illicit deal.