The donor, a Durham resident, contacted Town Council Chairman Jay Gooze and offered to pay what town officials called a purely economic issue, The Portsmouth (N.H.) Herald reported.
The town originally asked the Obama for America campaign team to pay the roughly $20,000 to $30,000 costs for security during Obama's visit to Oyster River High School.
The Obama campaign told the town it does not participate in security or traffic control planning and such decisions are "exclusively within the control of the appropriate government officials," particularly the U.S. Secret Service.
The Town Council had planned on having a special meeting Monday morning to discuss how to tackle the financial burden the security cost would put on the town before it received the donation.
"We are grateful for this generous offer," said Gooze, an Obama supporter, who stressed Durham is excited to have the president visit.
"The excitement is palpable in our New Hampshire college town as the president prepares to visit," he said. "The warm welcome he will receive from our residents -- young, old and in between -- in a packed high school gymnasium will leave no doubt that he picked the right place to come."
The incident sparked a debate over whether municipalities should foot security costs for campaign events -- even ones involving the president of the United States.
On Friday, Portsmouth police Chief Lou Ferland said he always takes on the cost for security when a sitting president visits.
"It's really a policy decision of the community," said Portsmouth City Manager John Bohenko. "It is a financial burden on the community when the president does visit, [but] it's always an honor to have the president visit your community."
Rosie O'Donnell unveils nearly 50-pound weight loss
Justin Bieber crashes Drake Bell's album release party