Tivity Health Systems of Nashville has agreed to buy Nutrisystem, the 45-year-old Fort Washington-based diet meals company, for about $1.4 billion in cash and stock, the companies said Monday.

The deal marks the latest sharp turning point in the history of Nutrisystem, which was founded by vacuum-cleaner distributor turned Philadelphia 76ers owner Harold Katz as Shape Up in the early 1970s. Its fortunes have varied in cycles like a dieter alternating careful eating with holiday binges.

Investors were skeptical, dumping Tivity shares and pushing its stock down more than 30 percent to a close of of $27.65. Nutrisystem shares closed at 43.68, toward the deal price of $47 a share.

The price marked a 30 percent premium to Nutrisystem’s value last week, but a discount from its peak value in 2017. Nutrisystem shares hit a recent peak above $54 in 2017 but fell below $30 last spring after disappointing financial reports.

The merger plan calls for Nutrisystem chief executive Dawn Zier to stay on as Tivity’s president and chief operating officer, reporting to Tivity chief executive Donato Tramuto. (Zier, paid $4.7 million in cash and stock last year, owns more than $12 million worth of Nutrisystem stock, at the deal price.) And Nutrisystem’s Fort Washington office will remain open.

The deal includes a $45 million cancellation fee in case Tivity doesn’t close the sale. That’s about three-quarters of each company’s profits for 2017.

But Tivity also said it plans $30 million in yearly cost cuts, implying that it will terminate some Nutrisystem jobs, which totaled around 600 according to its last annual report. If Nutrisystem employees cost $100,000 a year, the cuts could include as much as half of Nutrisystem’s workforce. Tivity, which employed 475 at its last annual report, will borrow to finance the cash cost of the sale, analyst Kyle Mikson wrote in a report to clients of Cantor Fitzgerald, the New York-based stock brokerage.

The combination adds Nutrisystem’s packaged meals and its diet customers to Tivity’s SilverSneakers, Prime Fitness, WholeHealth Living, and flip50 health programs, which are used by insurers and health providers to encourage aging Americans to exercise more and eat better. Besides its flagship meal brand, Nutrisystem also owns the South Beach Diet and DNA BodyBlueprint lines.

“We believe the deal makes strategic sense” for the buyer, analyst Mikson added, predicting Tivity’s share price, recently in the high $30s, should rise.

But Mikson also warned that Tivity’s previous businesses could head south amid health-care industry cost-cutting. For example, United Healthcare Inc., one of the largest U.S. insurers, has reduced its use of the company’s SilverSneakers health and fitness program for insurance customers “and should do so again in 2019.”

Nutrisystems, a longtime competitor to WW, formerly called Weight Watchers, and other diet-meal programs, initially sold liquid protein food supplements to people looking for rapid weight loss, before shifting to prepared low-calorie meals.

It has had a history of feast or famine. Sales topped $1 billion in the 1990s, but fell to half that after an abortive internet initiative. Personalities including self-help guru Susan Powter have served as Nutrisystem spokespeople.

An architect of the company’s profit revival, its brand expansions and its eventual sale is Michael J. Hagan, who earlier cofounded VerticalNet, the Philadelphia area’s flashiest dot.com in the 1990s. Hagan served as chief executive at Nutrisystem in the mid-2000s and has been board chairman since 2012.

A St. Joseph’s University graduate and benefactor, Hagan also founded the LifeShield home security company, and sold it to DirecTV in 2013, then bought it back through his Hawk Capital Partners investment group in 2017 (the Hawk is the St. Joe’s mascot).

Hagan, an investor in a former ownership group of the Inquirer, has also served on the boards of FS Investment Corp., the South Philadelphia fund company which last week approved a merger with Corporate Capital Trust Inc. to form KKR Credit Advisors, and Actua, the investment company once known as Internet Capital Group, which liquidated earlier this year.