BMW is finding out that innovation is costly.

The German carmaker reported a 6% decline in second-quarter profit as it increased its spend on developing new technologies for electric, autonomous and digitally connected automobiles.

Even though the company reported a 0.7% increase in automotive deliveries in the quarter -- BMW delivered a record 637,878 vehicles in the period -- net income of 2.08 billion euros ($2.42 billion) was down from the 2.2 billion euros it earned a year ago. Revenue fell 2.9% to 25.02 billion euros.

The company said that it spent 2.61 billion euros on research and development over the first six months of the year, a 13.6% increase from a year earlier.

While that is a steep investment, BMW insists that the return on its investment is paying off.

"The percentage of deliveries accounted for by electrified vehicles is growing continuously and customer demand is making this type of vehicle an increasingly important aspect of the BMW Group's overall volume performance," the company said in its earnings report.

BMW reported electric vehicle sales rose 42.5% over the first six months of the year to 60,660 units, including a 6.1% jump in sales of its most popular EV, the BMW i3.

While BMW is spending the cash necessary to become a major player in the electric vehicle market, the bull case for Tesla Inc. (TSLA) - Get Report has always been for the company to become the BMW (high-end luxury) of the electric vehicle market.

However, Tesla has its own profitability problems, and is finding that becoming the BMW of the electric vehicle market is also costly.

As they encroach on each others' territories, BMW and Tesla are experiencing growing pains. But unlike BMW, which has the track record and cash to sustain a few losses, Tesla has a much slimmer margin for error going forward.