A New York law establishing a $600 million fund to battle opioid addiction was blocked by a federal judge, who found that the measure violates the U.S. Constitution.

Judge Katherine Polk Failla of the U.S. District Court for the Southern District of New York on Dec. 19 granted a request by an industry group to block the Opioid Stewardship Act, saying that the law unfairly punishes out-of-state drug purchasers. The law, which went into effect in July, requires pharmaceutical manufacturers...