A Boston federal judge held Wednesday that federal law pre-empts a Massachusetts state law limiting classification of independent contractors to those whose work differs from the company's usual line of business.

U.S. District Judge Denise Casper granted summary judgment to the state law's challengers in Massachusetts Delivery Association v. Healey. The ruling ended the trade association's five-year dispute, initially against the state's former attorney general, Martha Coakely. Sitting Attorney General Maura Healey took over the defense.

The association cited member X Pressman Trucking & Courier Inc., which offers delivery services by drivers who use their own vehicles, as an example.