Campaign funds can be returned to donors, of course, and asking them to donate to charities of the candidate's choice would undoubtedly bring in millions to hundreds of millions to those charities... or the candidate can donate funds directly to charities:
Proper Use of Campaign Funds and Resources
https://ethics.house.gov/campaign-activity/proper-use-campaign-funds-and-resources
Charitable or Community Service Projects. Campaign funds and resources may be used to establish or support a bona fide charitable or community service project in the Member’s district. On this point, Federal Election Commission (FEC) Advisory Opinion 1999-34 is instructive.54 In that opinion, the FEC approved a Member’s use of campaign funds to support a fundraising event for elementary schools in the Member’s district. Other participants in the event were local businesses, schools, PTAs, and volunteers. The Member’s campaign funds were to be used for printing and postage costs for promotional materials, as well as to match donations made by individuals dollar-for-dollar, up to a maximum donation by the campaign of $60,000.