I answered it in another thread. After being part of the company for a full decade, the largest parts of Eidos only ever lost money for S-E so when things came to a head the decision was made to just sell to whoever was the highest bidder at the time, no matter how low. Even if they are taking a wash, they can then put that money into something that they have more confidence in to turn a profit.
Embracer offered more than anyone else and thus got it for what most game fans consider "a good deal." People in this thread said that a lot of debt was also sold off with the deal, which I don't remember being announced at the time but does help explain exactly how to top talent game studios (and Dokomo rip) got sold for so little. Anyways, people overestimate the value of the IP involved, Deus Ex was always a niche game, the general audience seems to have turned away from Tomb Raider and their other stuff really is just an asterisk. Even though Embracer was able to turn around and get that Tomb Raider deal with Amazon, we still don't know the full terms of it (example: first reported as selling the IP for 600 million, then reported as selling only transmedia rights for 600 million, now reported as Amazon "spending 600 million" on Tomb Raider, -aka- creating and advertising the show are coming out of that pie too and not all money going to Embracer.)
And, for what its worth, I do think Embracer got a good deal with it. They pulled off that Amazon deal, which Square's management might not have had the savvy to get through, they used their industry connections to get Eidos Montreal (or was it CD? doesn't matter which) assigned as a co-developer on Microsoft titles, outsourcing the risk to another company in exchange for a steady income, they have tons of freedom to outsource stuff like LoK and, yes, even Gex to other parts of Embracer or to third parties, if they so choose. Those were things that Embracer is really good at and Square is really bad at, meaning that both sides of the deal had reason to value the asset differently and engage in the sale.
Having said all that, there were a few potential other homes for them, Sony, Amazon, Microsoft, various western or Chinese third parties, and I would have thought they fit in best with Sony, but Embracer is far from the worst home. I am sure they all breathe a sigh of relief that they aren't part of Amazon or Take 2 right now.
edit: Also, to talk about the other side of your question. Whereas Eidos assets, sans Just Cause and their western publishing deals, always lost S-E money, Codemasters was always profitable, it had to be as it was lacking a corporate benefactor. And its singular focus on racing games meant that it had added value for EA, who could use them as a co-developer on Need for Speed. I think the real question there is how long CM continues to create its own niche racing titles (which do make money...) versus being fully subsumed into NfS. Either way they have a direct, easy road to being a financial contributor to EA, hence them being purchased despite the "high" price. The old adage of having a highly valued stock- "do one thing well" was in full effect here.