There are two main ways in which a company can buyout another firm. It can do it through a leveraged buyout which involves taking out a large amount of debt against the cash of the target company. It can also be a friendly buyout, where one company agrees to be purchased by another for cash and/or stock. In either case, the price of the stock of the buyer and the company selling out is always the same.
Stocks and Bonds
There are two different ways in which an investor can invest in a company, through stocks, bonds or a hybrid of the two. Bonds represent a form of debt to the company, and investors are paid a rate of interest to compensate them for the use of funds. However, shareholders are considered owners in the firm. In the case of a buyout, bondholders are still obligated to be paid back the loan, but that's it. Bondholders do not generally profit from a buyout.
Equity Vs. Debt
Equity is different from debt. As owners in the company, equity (stock) holders are entitled to receive a portion of the profit made on a purchase or buyout deal. That is, if a company is being purchased, its stock price value usually goes up. The stock price of the purchasing company usually goes down. Stockholders benefit from any increase in share value, but bondholders do not benefit from this sort of bond price appreciation.
Psychology of the Market
It might seem strange that a company with the purchasing power to buyout another company experiences a decrease in stock value, however, buyouts cost money. A buyout can be seen on the income statement as "restructuring charges" and, although considered one-time charges, the costs associated with a merger or buyout can go on for years. Additionally, if the buyer pays too much for the company, the market may devalue the stock. The market may also not like the merger and show it by dumping the stock. There are myriad reasons as to why the share prices of the buyer tend to go down after a buyout.
There are just as many good reasons for the stock price of the company being bought out going up. The primary reason is that usually companies pay a premium for the purchase of a company. That is, a company must act in the best interest of its shareholders and selling the company at a discount to the current market price is not a good deal for shareholders. Instead, the buying company must pay the target company a premium.