The purchase a company, a business, product lines, or brands is called an acquisition. The purchase, by one company, of another, is also called a takeover.
Buying a listed company requires making a takeover bid and going through a heavily regulated process.
Takeovers are almost always beneficial for the shareholders of the company being bought (as the share price is pushed up). They are rarely good for the shareholders of the acquiring company. They do tend to benefit the management of the acquiring company who end up running a bigger company. Even acquisitions that are bad for shareholders usually make management richer.
Organic growth is usually more valuable than growing a business through acquisitions.
Small strategically important acquisitions that fit well with the businesses the company already has ("bolt on" acquisitions) tend to work better than larger ones. Acquisitions can only be justified if the business being bought will be worth a lot more in the hands of its new owners than in the hands of the sellers. The acquiring company should have a clear and convincing explanation of why this is so.
Acquisitions are usually paid for either in cash or with newly issued shares or both. The former leaves the company more highly geared. The latter means that the acquirer's original shareholders are left holding a smaller proportion of the enlarged business. The premium they need to pay over the normal share price of the acquired company means that they lose out, to some extent, to the benefit of the original shareholders in the company being bought.