Elon Musk has been riding high lately, but he's suffered a setback in the Lone Star State.

Texas' state legislature failed to vote on a bill backed by Musk's Tesla Motors (TSLA) that would have loosened the state's restriction on dealerships owned by automakers. The legislature concluded its most recent session last week, and won't be back until January 2015.

Tesla plans a massive expansion of its supercharger network, finally making a cross-country trip possible.

Tesla has tangled with dealership associations in a number of states in its effort to sell its Model S electric sedan directly to consumers rather than using franchised car dealers. Musk testified before lawmakers in Texas on the issue earlier this year.

General Motors (GM), Ford (F), Toyota (TM) and others don't sell cars to customers. They sell cars to independently owned and operated dealers or distributors who, in turn, sell them to the public, usually after some negotiation over the final price.

Tesla's showrooms, by contrast, are owned and operated by the company. Most are in shopping malls, with only enough cars on hand for display and test drives. Every Tesla car sells at full sticker price, and service on the cars is performed at separate garages owned by Tesla.

Auto sales are mostly regulated at the state level. In some states, Tesla has had little or no problem opening its stores. In other places, like Texas, auto dealers and their allies in government have resisted Tesla's plans, fearing they could ultimately undermine the system of franchised auto dealers.

"Franchise laws give dealers the opportunity to have a much wider presence in the country, and they give consumers a better opportunity for purchase and service of their vehicles," said Bill Wolters, president of the Texas Automobile Dealers Association. "We're very glad that we made it through this legislative session and fought off this challenge to a set of laws that's good for our country."

For its part, Tesla worries that traditional franchised dealers, who also have gasoline cars to sell, won't represent its products properly or aggressively enough. Dealers pressed to make quick sales will likely be tempted to steer customers to gasoline cars rather than explain the benefits of the Model S, Diarmuid O'Connell, Tesla's vice president for business development, told CNNMoney last month.

Speaking at Tesla's annual shareholder meeting Tuesday, Musk cited polling data from various states to argue that consumers overwhelmingly favor allowing direct sales.

"Clearly, if democracy was working properly and the legislators were implementing the will of the people, something else would be happening, and there would not be legislation trying to artificially restrict direct sales," Musk said.

"Right now, the autodealers' association -- they're crowing about the fact that they were able to defeat us in Texas and that they're making so much progress in North Carolina and stopping us in Virginia," he added. "I think it's outrageous."

Related: Tesla tripling supercharger network for LA-to-NY trip

At present, Tesla has showrooms in Texas, but employees can only show off and explain the car. They can't legally give test drives, take orders, or even mention the price if customers ask.

Texans can still order the Model S online, but Tesla can't deliver it directly -- the buyer has to arrange for delivery through a third-party shipping company.

"I think customers are going to lead a revolt on this front," Musk told shareholders Tuesday, to a round of applause.

CNNMoney's Peter Valdes-Dapena contributed reporting.