The Michigan House on Wednesday passed a bill that would exempt California-based electric automaker Tesla from some elements of a state ban on direct vehicle sales. 

The changes that the House approved in a 65-39 vote would enshrine in law the terms of an agreement between the state and electric car company Tesla Inc., which challenged the state’s ban on direct sales in 2016. Michigan’s ban on direct sales requires companies to sell cars through franchises — as Detroit’s automakers do — instead of directly to consumers. 

In January, the state settled with Tesla and allowed it to sell cars to Michigan customers if the sale, on paper,took place outside the state. It allowed Tesla Michigan, a subsidiary, to own and operate service and repair facilities in the state. 

The legislation approved Wednesday enshrined those elements