Each company likely does so for its own reasons. Your examples:
- Starbucks apparently bought Teavana because they wanted to sell their teas.
According to Polygon,
Razer's June 12 purchase only included the content catalog, software assets, online store and name of Ouya; it didn't include the now-dated console or poorly received controller.
In other words, Razer wanted to be able to sell the things that Ouya sold on Razer's platform, Forge TV. Razer didn't need the console or controller to do that.
Sears didn't buy Kmart. Kmart bought Sears and changed their name to Sears Holdings. Presumably Kmart did so to acquire Sears brands like Sears, Kenmore, DieHard, and Craftsman (later sold to Black & Decker).
Both Sears and Kmart were struggling when the merger went through. Years later, they closed a number of stores.
More generally, buying a failing company gives access to the customer information that the company had. Kmart can advertise its products to people who get the Sears catalog. Razer can offer its up-to-date console and controllers to Ouya customers.
Or the failing company may have great products. Starbucks dumped the stores but kept the teas. Kmart eventually spun off the Kenmore, Craftsman, and DieHard brands (and the spin-off sold Craftsman), but it still retains the rights to sell these brands.
I'm not convinced that preventing competition is enough.
Starbucks may be the leading coffee shop brand, but it has a minority of that market. It's only 39.8% of the coffee chain industry. It also competes with independent coffee houses and places that sell more than coffee (e.g. McDonald's). Further, teas compete most strongly with other teas, not coffee. Other tea brands were probably helped more by Starbucks shutting down Teavana stores than Starbucks was. Starbucks main gain was the new product.
Razer deliberately did not buy the console and controller part of Ouya, but those were the competitive parts. Razer did buy the catalog and online store, the parts where they were weak.
Amazon.com is better than Sears at what used to Sears' mainstay: remote purchases. Eliminating Sears would have probably helped Amazon more than Kmart. Failures there are more likely due to failure than an intentional plan to reduce competition. Kmart bought Sears because Sears was in many ways the stronger brand. Which may explain why you think that Sears bought Kmart. Since the purchase, they've concentrated more on the Sears brand than the Kmart brand.
Part of what may be confusing is that stores aren't typically worth that much. They are often leased. It's not that hard to open a new store. So very little of the value of a company is in its stores. And in the case of a failing company, the stores may cost more to maintain than they provide in value.