PepsiCo announced on Monday that it planned to buy SodaStream, the popular maker of home-carbonation machines, for $3.2 billion, as the beverage giant extends its bet on products that are not sugary sodas.

The deal is a late effort by Indra K. Nooyi, PepsiCo’s departing chief executive, to firmly steer the beverage company toward healthier snack and drink offerings. Under Ms. Nooyi, it has shifted more and more attention to products like premium bottled water, baked food and veggie chips.

That strategy has drawn intense criticism at times, including from activist shareholders. But Ms. Nooyi has persisted, noting that sales at the company have grown 81 percent under her tenure.

The transaction announced on Monday, PepsiCo’s biggest in years, also gives the company another potential source of revenue: refills of flavored syrups and carbon-dioxide gas, in what is often known as the razor-and-blades model. Yet in doing so, the company will try to make work what its big rival, Coca-Cola, could not do four years ago.