State Attorney General Martha Coakley says thousands of Massachusetts motorcycle owners will receive insurance refunds from the state's largest automobile insurer for overcharges on their policies.

Coakley's office announced Monday a $14.6 million settlement with Commerce Insurance Co., the largest such agreement in the agency's four-year motorcycle insurance investigation. Nineteen companies have settled with the state, totaling $57.4 million in refunds for more than 150,000 Massachusetts policies.

The attorney general's office says Commerce Insurance will issue refunds averaging about $360 to more than 40,000 policyholders.

Dan Olohan, executive vice president for MAPFRE, the Spanish insurer that owns Commerce, said the company has been working with Coakley's office to serve the ``best interest'' of its customers.

Coakley accused Commerce Insurance of overcharging customers between 2002 and 2011 by using inflated motorcycle values.