Google has agreed to buy Motorola Mobility for $12.5 billion, giving the search giant valuable intellectual property and getting it directly into the handset business. Google will pay $40 a share in cash for Motorola, a 63% premium over the company's closing stock price on Friday.