Donald Trump criticized universities last month for hoarding their endowments, saying that they “use the money to pay their administrators, to put donors’ names on their buildings.” He added that “many universities spend more on private-equity fund managers than on tuition programs.” Mr. Trump suggested that he would work with Congress to encourage colleges to direct more of their investments toward students.

That’s a laudable—and achievable—goal. Many of the schools with large endowments, such as those in the Ivy League, will protest that they are private institutions, and that the government shouldn’t tell them how to spend their money. But these colleges also receive massive cash transfers from the federal government, giving Washington a way to impel them to put their endowments to more responsible use.

As of 2014, the eight Ivy League schools had 58,982 undergraduate students and total endowment funds on hand of about $117 billion, according to a study from OpenTheBooks. That works out to roughly $2 million per student. Yet between 2010 and 2014, according to the same study, these schools received some $30 billion of taxpayer contracts, grants, direct payments, student assistance and tax exemption. In other words, federal cash and subsidies over that time averaged nearly $102,000 per student each year.

Washington is effectively paying colleges not to spend their endowments. Americans worry about skyrocketing tuition, but federal funds are allowing schools to shift cash to new buildings and administrative salaries, while taxpayers take care of the students.

Congress should pass a simple law to rectify the situation. Schools with swollen endowments should face a choice: Keep tuition below the rate of inflation, or lose access to federal loans, scholarships and research programs. The rule could apply to any college whose endowment exceeds $1 million per undergraduate student. That would include at least 30 institutions—almost entirely private colleges and universities.

Universities protest that their financial situation isn’t as rosy as it appears. Of 35 liberal-arts colleges that belong to a fundraising group called Sharing the Annual Fund Fundamentals, nearly a third are lagging in this fiscal year, compared with the one before. Almost two thirds had fewer donors, according to the New York Times. And endowments have taken a beating in the market as well. According to data collected by InsideHigherEd, Dartmouth’s fell 1.9% this year and Cornell’s is off by 3.4%. Harvard’s has fallen 2%. But these funds exist for this reason—to help schools hedge against tough times.

The more important measure is the endowments’ long-term performance. Data from Harvard show that “over the last twenty years the endowment has returned 10.4% annualized.” The 94 schools with endowments over a billion dollars averaged 7.2% growth from 2005-15, according to a report last year from the National Association of College and University Business Officers. These universities are in no danger of having to make any serious cuts, and they would easily be able to fill investment shortfalls with the money already in their pots.

For more than a year, Rep. Tom Reed has been pushing legislation that would remove the tax-exempt status of any institution with an endowment of over $1 billion if 25% of the endowment’s income is not spent on financial aid. There is a better way. Congress should create new classification for tax-exempt institutions, into which the schools with the largest endowments per student would be placed. Donations above a certain threshold would be only partially tax-deductible.

Politicians needn’t get greedy. It is wonderful that private educational institutions—which, despite so much silliness, have produced great research and some well-educated students—have done so well for themselves. Alumni are apparently still happy with the product they have purchased. But there is no reason these institutions need to be siphoning funds from public coffers. Recent losses notwithstanding, Harvard can stand on its own two feet.

Mr. Piereson is a senior fellow at the Manhattan Institute. Ms. Riley is a senior fellow at the Independent Women’s Forum.