James S. Riepe spent 40 years wrestling investment markets as an executive at mutual fund giants T. Rowe Price Group Inc. and Vanguard Group Inc.

He says the only thing that gave him sleepless nights, in all those years of market ups and downs, was the University of Pennsylvania's financial condition in 1999, when he became chairman of its board of trustees.

That winter, the university announced plans to spend $200 million on new and expanded student dormitories.

But those plans went out the College Hall window as Penn's medical complex lost $200 million that year - $120 million from operations, $80 million from uncollected bills.

Riepe's predecessor, retired Merck & Co. Inc. chairman Roy Vagelos, told Riepe he was sorry. "And I said, 'It wasn't your fault, Roy,' " Riepe recalled.

"We'd borrowed money to buy all these hospitals and [physician] practices," he explained. "Then Medicare pricing was changed by the Balanced Budget Act of 1997. Hospitals across the country were devastated."

Penn had been slow to respond. "We had this incredibly complex governance structure within the medical area," he said. "Boards here, boards there. People running the health-care system were spending half their time going to board meetings."

The university fired William Kelley, Penn's hospital chief, and asked the trustees - businessmen, mostly - for help in reorganizing its medical operations.

It wasn't like fixing a corporation. "The academy is constructed very differently," Riepe said. "It's very decentralized, schools here, departments there, people who because of their tenure and because of their professional focus" don't engage with existential problems.

For example: Riepe said he went to meet with some of the doctors from the clinical practices. "I told them, 'The hospital is hemorrhaging money, and it's heavily [in debt].' They told me, 'We hope you can fix it. But we have $100 million in cash; we're doing fine.' "

He added: "It took some selling to say, 'No, we're in this together. The doctors can't be prospering and the hospitals hemorrhaging.' "

Riepe said he and former Wharton dean Russell Palmer told them Penn was thinking of selling the hospitals to Columbia HCA or another suitor. The research-oriented doctors didn't want to lose their "mother ship." They agreed to help the hospitals from their surplus funds.

The university sold its suburban hospital, got out of the family-practice business Kelley had built, and ended whole programs. After Riepe hatched a plan on a train ride, president Judith Rodin agreed to combine the hospitals, medical school, and clinical practices in a new and whole Penn Medicine, with Penn trustees in key board posts.

"By 2004, we knew we had it turned around," Riepe recalled, with financial performance above medical-industry averages, and enough cash to repay money borrowed from the university.

Stability helped attract effective managers. After a couple of short-term hires, the medical board brought in University of Chicago and Mount Sinai (New York) veteran Arthur Rubenstein as medical dean and hospital-system head.

Rubenstein built today's management team, and when Rodin retired in 2004, Riepe asked him to join the search committee that hired the current Penn president, Amy Gutmann, so Penn Medicine could "have some ownership with the new president."

Penn never did get around to replacing those dorms. "The Board of Trustees and the management concluded," Riepe said, "we didn't have much money to spend on this campus, so let's really be careful and pick our spots."

The school has built a string of new research facilities in recent years - Perelman Center for Advanced Medicine, Skirkanich Hall for Bioengineering, the Fisher Translational Research Center, the Roberts Proton Therapy Center - from donations and grants, "without borrowing any money," according to Riepe.

No "luxurious rooms" for undergraduates, like smaller colleges were building with borrowed money. Instead, Penn offered university land along 40th Street and elsewhere for a supermarket, cinema, restaurants. That helped lure private investors to build the Radian, Hub, and upscale Domus apartments on campus.

Penn got lucky when it moved its endowment toward "alternative investments" belatedly and carefully, avoiding the worst of the losses that drained the larger Harvard, Yale, and Princeton endowments. Penn slowed hiring, but was spared the larger layoffs and program cuts of what Riepe calls "our poor, formerly our richer, peers."

Riepe stepped down as Penn trustee chairman this month, replaced by Comcast executive David L. Cohen. The board faces a "fiscally tight" environment that Riepe says may last for years. Plus, "everyone is worried about health-care reform," he noted, and how much cost hospitals will eat.

But Cohen, as a former Penn Medicine board chairman, knows what he is getting into. And he'll still have Riepe at hand: He has moved over to head the Penn Medicine board, swapping posts with Cohen.