Geoffrey Holt, the caretaker of a mobile home park in Hinsdale, N.H., did little to stand out and mostly kept to himself, at least as far as Kathryn Lynch, the town administrator, knew.

He would sit on Route 119 and kick back and watch the traffic go by,” she said. “People really didn’t know who he was,” she added. “I mean, I didn’t even know what his name was.”

Mr. Holt had blended in for decades in Hinsdale, a town with a population of about 4,000, often sitting on his riding mower in the trailer park where he lived until his death in June at 82.

But he died with a secret that will change Hinsdale for years to come: He was a multimillionaire. And in his will, he had decided to leave all his wealth — $3.8 million — to his adopted hometown.

Ms. Lynch found out months after Mr. Holt died. She said her reaction was “shock.”

“That doesn’t happen in Hinsdale,” she said.

The arrangement had been struck decades earlier. In 2001, Mr. Holt approached the New Hampshire Charitable Foundation, a nonprofit, told it of his intentions and came to an agreement for the group to dole out the funds after his death.

“We have a number of people who will set up funds during their lifetime to do something after a lifetime,” Melinda Mosier, an executive with the organization, said in an interview. “A story like Geoffrey Holt’s,” she added, is “really the heart and soul of our communities.”

“The unique part is that he kept it quiet,” she said of the donation, which was first reported by The Bennington Banner. “He was very unassuming. He just really wanted to give back in a way that was truly about making the community better without any fanfare or recognition on his part.”

Edwin Smith, who goes by Smoky, was Mr. Holt’s best friend and employer. Mr. Smith, a 78-year-old lifelong Hinsdale resident, said in an interview that he met Mr. Holt sometime in the 1970s. He said Mr. Holt grew up in Springfield, Mass., and settled in Hinsdale after serving in the Navy and earning a master’s degree at American International College, where his father, Lee Holt, was an English professor.

Eventually, Mr. Holt moved into a mobile home on a tract of land that Mr. Smith owned, and lived there for a time with a widow who owned the home.

Mr. Holt did odd jobs for Mr. Smith over the years, like clearing brush, plowing snow and other maintenance tasks. He even house-sat for Mr. Smith and his wife when they were away on vacation. Mr. Smith said that his friend lived “very frugally.”

But before Mr. Holt started working for Mr. Smith, he had a job at a grain mill operated by Agway Inc. in Brattleboro, Vt., which bought him out in the mid-1980s. This left Mr. Holt with a small nest egg that he invested in several mutual funds with a broker in Keene, N.H. One was what Mr. Smith described as a communications fund.

In 2000 or so, Mr. Holt revealed his wealth to Mr. Smith. His investments had done quite well, Mr. Smith recalled his friend telling him, but he didn’t know what to do with the money. Mr. Holt had no children. He had been married once, and only briefly, in the 1960s. He was in contact only occasionally with a younger sister who lives on the West Coast, and he wasn’t particularly close with any members of his extended family.

Mr. Smith was caught off guard, but he wasn’t totally surprised. Mr. Holt was an avid reader of The Wall Street Journal, The New York Times and Forbes magazine. Mr. Smith was not shocked to learn that his friend was a savvy investor.

“I guess you really didn’t know whether he had money or not because he never bragged about anything,” Mr. Smith said, adding, “Geoffrey didn’t change when he found out he had seven digits in an investment account.”

Mr. Smith said that he suggested that Mr. Holt consult an estate lawyer, and that perhaps he should use the money for something people in Hinsdale might remember.

In September 2021, Mr. Holt had a stroke. By 2022, he had moved into an assisted-living facility. Mr. Smith became his primary caretaker. And that was when Mr. Smith found out what Mr. Holt had done: He had arranged to leave all his money to the town of Hinsdale.

Ms. Mosier, of the New Hampshire Charitable Foundation, said the terms were that the $3.8 million was to be used to “support projects, programs and organizations that provide health, educational, recreational or cultural benefits to the residents of Hinsdale.”

Mr. Smith was one of three advisers named to help steer the funds. Another is John Smith, a cousin of Edwin’s, and the third was Lewis Major. Both were friends of Mr. Holt’s. Mr. Major died about three years ago.

Mr. Smith wants to use some of the money to buy a vote-counting machine for Hinsdale, where votes are counted by hand.

“Geoff was so adamant about voting, and this would help the whole town quite a bit,” Mr. Smith said. “I’m not sure it should come out of taxpayer dollars, but it could come from this, and it would cross off one of the things on Geoff’s to-do list.”

Hinsdale’s annual budget is roughly $12 million, according to Ms. Lynch, the town administrator, so Mr. Holt’s donation will have a profound impact. She said that the money could be used to fix the town clock or paint the town hall, but that it would be spent frugally, in the spirit of how Mr. Holt lived.

“You hear about those millionaires next door and you just never think you’re going to be one of those lucky people that get that million dollars and we are,” she said. “I feel we’ve won the lottery.”