The deal universe is abuzz about how Google lost billions of dollars in selling Motorola Mobility to Lenovo for $2.91 billion. After all, the technology giant paid $12.5 billion for Motorola, so clearly it would take a $9.5 billion hit, right?

Not so fast.

Breaking down the admittedly messy math shows that Google didn’t exactly lose nearly $10 billion on the deal. Here are some back of the envelope calculations.

When Google bought Motorola, the hardware maker had about $3 billion in cash on hand and nearly $1 billion in tax credits . So that brings the original deal’s effective price down to about $8.5 billion.

. So that brings the original deal’s effective price down to about $8.5 billion. Then, Google sold Motorola’s set-top box business to Arris for nearly $2.4 billion . That lowers the effective price to roughly $6.1 billion.

. That lowers the effective price to roughly $6.1 billion. Now, Google is selling Motorola Mobility — primarily the handset business, along with a few patents — for $2.9 billion. So we’re at about $3.2 billion.

It’s worth noting a few more things. In a regulatory filing in 2012, Google disclosed that it valued Motorola’s overall “patents and developed technology” at about $5.5 billion.

Related Links Google Is Selling Its Mobility Unit to Lenovo for About $3 Billion

Under the terms of the deal announced on Wednesday, Google will hold onto the bulk of Motorola Mobility’s patents. By comparison, the group of companies like Apple Inc. and Microsoft that bought Nortel Networks‘ patents out of bankruptcy paid about $4.5 billion in total. So Google got a pretty good deal.

Moreover, it has drawn revenue from Motorola’s patents since the transaction closed, putting a further dent in that deal’s cost.

Of course, these calculations ignore the strategic benefits Google has enjoyed from the deal. It locked up important patents to defend its Android ecosystem, while climbing into a position to pick the right strategic partners for the Motorola hardware businesses.

Admittedly, Motorola has also run up millions of dollars worth of operating losses during its time as a Google subsidiary. But all told, the technology giant did not do so bad after all.

Update: There is one thing to keep in mind, however: whether the value of the patents holds up in court. Last year, Microsoft claimed victory in its dispute with Motorola over the value of standard essential patents, when a judge determined that a reasonable licensing rate for some patents was a shade under $1.8 million a year. That’s well below the $4 billion a year that Motorola had sought.