If you were shocked to read a few months ago that Facebook had agreed to pay $19.6 billion to buy WhatsApp, you will be floored to know that the final price on the deal ballooned to $21.8 billion.

It all comes down to the fact that Facebook decided to pay with its own stock rather than cold hard cash, a move that cost it billions more. It is a lesson in how – in Silicon Valley – a company’s stock may just be funny money these days.

In February, when Facebook announced the WhatsApp transaction, it pegged the purchase price at $16 billion. At the time, however, it did not include the compensation it was also giving WhatsApp employees to stay on at Facebook, which added another $3.6 billion to the bill.

But even then, the final cost was uncertain because Facebook actually agreed to pay the owners of WhatsApp in stock and cash. The cash component was the smaller: a measly $4 billion. The remainder was nearly 184 million shares of Facebook class A common stock, worth $12.5 billion based on Facebook’s closing price on the day of the announcement. The class A shares are the low-voting common stock. They allow Facebook’s chief executive, Mark Zuckerberg, to issue shares without diluting his controlling stake, which he holds through the class B shares that have the majority of voting rights.

Facebook also agreed to kick in another nearly 46 million restricted stock units as incentive compensation for employees. Jan Koum, WhatsApp’s co-founder and chief executive, received more than 50 percent of those units. That means he alone was getting Facebook stock worth $1.7 billion the day the deal was announced. These units vest over four years, and he will have to stay there to earn the full amount, but still this is an extraordinary payout by any measure.

Let’s just stop here and say this may be the greatest employment contract of all time.

The WhatsApp deal needed regulatory approvals. These took time, and it was not until eight months later that the deal closed, on Oct. 6. On that day, Facebook’s stock price had risen to $77.56 a share from about $68 in February. This gave the deal a value of $21.8 billion. Mr. Koum’s employee incentive package had climbed to be worth almost $2 billion.

In other words, by issuing stock, Facebook ended up paying $3 billion more than if it had just paid cash. (With this week’s market decline, Facebook’s stock has also come down somewhat; if it had closed on Wednesday, the deal would be worth “only” about $20.5 billion).

Facebook’s beneficence is not just limited to WhatsApp. A similar thing happened with its acquisition of Oculus. At the time it was announced, Facebook valued the Oculus deal at $2 billion in cash and stock – and up to $300 million more, depending on Oculus’s performance.

But by the time the deal closed in July, Facebook’s share price had risen 15 percent since March, translating to a few hundred million more dollars for Oculus shareholders. That is chump change for Facebook, to be sure, but it still could buy employees a lot of free meals or make a nice dividend to shareholders.

In other words, by issuing out stock, Facebook is paying billions more than it needed to. Had it paid cash, Facebook would have frozen the amount paid and saved its shareholders money.

Certainly, Facebook’s stock price could have – and did – fallen after investors fretted over the huge prices paid. But in the end, the stock recovered.

Also, Facebook might just not have had the cash to make the deal – or did not want to borrow it, even if banks had been willing to lend this amount. And ultimately, we do not know at what price the WhatsApp people will sell their shares. WhatsApp employees will be permitted to sell their shares freely once Facebook releases its third-quarter numbers on Oct. 28 and files the necessary S.E.C. documents to permit those shares to be sold. (Ferrari dealers in Silicon Valley: take note.)

Even with these caveats, there are lessons here.

Outside of Silicon Valley, stock has lost its luster as an acquisition currency. The reason derives in part from the last technology bubble. If a company has to pay cash, it knows exactly what it is paying and will most likely be more careful to avoid overpaying because cash is something that needs to be earned and repaid. These days, stock consideration is mostly used strategically where it is a real coming together of the companies in a way that shareholders are invested in the joint outcome of the merged entity.

With stock, though, it can be given rather freely without the same discipline. Here, you only need to look at the AOL/Time Warner merger, which was financed through AOL’s overpriced stock. This most notorious of deals would never have happened if AOL had been required to pay cash.

Last year, 67 percent of all deals were cash only, and just 12 percent of deals were stock only (the rest involved a mix). The bias is because of market skepticism that if a company pays with stock, it is house money and might result in an overpayment.

In Facebook’s case, it can just issue these shares without a shareholder vote. The only check on overpaying is Mr. Zuckerberg and his interest in preserving value, since he controls the company.

Yet, Mr. Zuckerberg might not be worried about the dilution because he would still control the company in any case. And he might find other benefits more appealing, such as being C.E.O. of a bigger empire.

The real test may be whether Facebook would have made this acquisition if it had to borrow the money and pay it back? Google, for example, may have overpaid for Nest, a maker of thermostats and other home products. But the amount it paid, $3.2 billion, was in cash, requiring Google to impose some discipline.

Sure, in Silicon Valley discipline is a relative term. But for Facebook, at least, the latest market sell-off should make it pause before its throws around its money so freely.

Facebook Agrees to Pay $16 Billion for WhatsApp The acquisition of WhatsApp is Facebook’s largest by far, and marks a new height in the frenzy to acquire popular technology start-ups.