Shares of Tesla (TSLA 4.63%) are up 102% year to date, but analysts believe the popular EV stock hasn't topped out yet. 

New Street Research analyst Pierre Ferragu sees the stock reaching $300. That is about 21% above the current share price. Piper Sandler sees the stock reaching $280 based on Tesla's software opportunity and what it can do for the company's profits over the next few years. 

Software is, indeed, a big opportunity, since Tesla charges as much as $15,000 for its full self-driving car software. But its profit-earning ability runs deeper than software.

Long-term investors should pay attention to Tesla's relentless pursuit of reducing costs across the business. I believe this is still an underappreciated aspect of the company's culture that makes the stock worth buying right now.

Built for shareholder returns

Tesla has experienced exploding demand in recent years, but what may not get enough attention is the rapid increase in the company's profit margin.

TSLA Profit Margin Chart

TSLA Profit Margin data by YCharts

Over the last five years, Tesla's profit margin has risen from negative 20% to positive 13.7%. Revenue has more than tripled, but improving margins have driven earnings per share up an incredible 2,500%. 

There are several ways Tesla accomplishes this, and several reasons why it should continue growing earnings and fueling a higher stock price over the long term.

Tesla designs everything in-house, which goes a long way to saving money on alternative products and materials. Tesla's goal is 20 million electric vehicles per year. It's a mighty target next to the company's 1.3 million vehicles delivered in 2022. By reducing costs and improving efficiency, Tesla can overcome production constraints and lower prices to grow demand.

One way it's reducing costs is building smaller factories for production of the new powertrain generation. Tesla is also designing its own transistor packages, eliminating the use of rare earth materials in its EVs, and reducing its reliance on silicon carbide, an expensive semiconductor. 

Tesla is gaining manufacturing expertise that is giving it a competitive advantage. The company is even building its superchargers in house, then loading them on a truck and using a crane to install them at the destination site. By pre-building the chargers, the company saves money on deployment costs. Just one more way Tesla keeps profits on an upward trajectory.

In fact, Tesla's lead powertrain engineer Colin Campbell said the company's improving efficiency will be "transformative for the adoption of EVs." 

Don't underestimate Tesla

When you are doing everything in-house, you are also raising the risk that hiccups in production could cause delays and uncertainty in sales. Tesla has experienced these delays before, as with the initial ramp of the Model X and Model 3. The upshot, however, is that Tesla can better maintain quality standards over the car ownership experience, which puts it in good company with Apple.

Another thing to keep in mind is that the stock is also already pricing in a lot of growth. At a forward price-to-earnings ratio of 59, Tesla isn't cheap, but it likely never will be. The expensive valuation will lead to occasional dips in the stock when things don't go exactly like Wall Street expects. But volatility will have to to be the price investors pay for the long-term ride. 

Despite the inevitable bumps in the road, patient shareholders should be rewarded. The stock's price-to-sales multiple is at multi-year lows, and that signals the market is not giving Tesla full credit for its ability to increase margins over the long term. This should set up better returns as the company continues to reduce costs and put more EVs on the road.