Drug giant Merck & Co. announced Monday that it will spend billions to buy a local biotech company that has struggled to bring a cancer drug to market.