On his way to scooping up $15 million in campaign contributions in California in two days, President Donald Trump was troubled. The Golden State has a growing problem with homelessness, he had learned (presumably from one or more of the 18 segments Fox News has aired about it this year), and he was determined to do something about it. After all, it directly affects a constituency near and dear to his heart: rich foreigners who buy or rent expensive real estate.

“In many cases, they came from other countries and they moved to Los Angeles or they moved to San Francisco because of the prestige of the city, and all of a sudden they have tents,” Mr. Trump said while aboard Air Force One. “Hundreds and hundreds of tents and people living at the entrance to their office building. And they want to leave.” These people came for the “prestige” of cities like San Francisco and Los Angeles, and America’s most destitute are apparently spoiling the view.

Rather than dwell on the outrageous heartlessness of Mr. Trump’s attitude, let’s root for him to do the right thing for the wrong reasons. If Mr. Trump cares about homelessness, there’s plenty he can do. For starters, he could agree to a request from Gov. Gavin Newsom and other California leaders to authorize 50,000 more housing vouchers through the Section 8 program and another that serves veterans, and to increase the value of those vouchers to account for California’s crushing housing costs.

Mr. Trump and Dr. Carson could also drop a plan to change the rules on housing vouchers that would prohibit a household from receiving them if even a single member is an undocumented immigrant. Historically, such families have qualified for assistance prorated for the number of members who have proper legal status in the country, but the Trump administration wants to kick them out altogether. That puts housing at risk for more than 100,000 people nationwide, including 55,000 children. They could also stop trying to kill Community Development Block Grants, a decades-old program that represents one of the federal government’s last remaining direct investments in urban redevelopment.

The Trump administration does have a point that restrictive zoning laws that reduce housing density and make it difficult to integrate affordable housing into existing communities are a problem. That’s also not something the federal government can do much about, but fortunately, state and local leaders in California are aware of the problem. The legislature there has enacted a series of measures in the last two years to address the lack of affordable housing, and local zoning reform is a major topic of conversation and legislation. Bills that would have preempted some zoning rules that hinder the development of affordable housing and limited annual rent increases were top priorities of Gov. Newsom this year.

What would not be helpful are the kinds of plans The Washington Post reported last week that the Trump administration was considering, like attempting to sweep homeless people off of the streets and into federal facilities reconstituted as temporary shelters. As we have witnessed time and again in Baltimore, forced relocations at best move the problem around and at worst further alienate a deeply vulnerable population from the government.

Fortunately, sending in the cops to round up the homeless is not something the federal government has any clear legal authority to do. The White House had at one point hinted that law enforcement would play a central role in its efforts, but that’s not the purview of the federal government, as Housing and Urban Development Secretary Ben Carson noted after touring a federally supported housing facility in San Francisco. (Nonetheless, Dr. Carson did request a meeting with Los Angeles Police Chief Michel Moore to discuss homelessness during his trip to California.)

Raiding homeless encampments doesn’t solve homelessness. Providing decent, affordable, safe housing does. State and local governments need to pay attention to the barriers they have erected to limit the construction of such housing and to shunt what exists into communities with few economic and educational opportunities, but the federal government could do much more to provide support. It could eliminate Section 8 waiting lists by treating housing vouchers for low-income people as an entitlement. It could provide better tax credits for affordable housing. It could renew federal direct investment in building subsidized housing. It could invest far more in the maintenance and renovation of the public housing that already exists. Those actions might not end homelessness in San Francisco or Los Angeles (or, for that matter, Baltimore) as quickly as Mr. Trump’s fellow high-end real estate investors might like, but they would make an enormous difference to the actual victims of America’s homelessness crisis.