A dying mechanic wanted a few thousand dollars to leave to his wife, two sons and infant daughter. A politically connected millionaire, now running for Virginia governor, wanted to make some money. And a Rhode Island estate planner wanted to become ambassador to the Vatican.

All three came together on paper in late 2006 in a deal struck just two months before the 44-year-old mechanic died of cancer.

The mechanic got $5,000. The millionaire, Democrat Terry McAuliffe, made at least $47,000. But the estate planning lawyer, Joseph Caramadre, went to prison instead of Rome.

Caramadre helped McAuliffe place a bet on the dying man based on a loophole the estate planner had sniffed out in the fine print of insurance annuities. Although the loophole was legal, Caramadre has pleaded guilty to stealing the identities of the terminally ill as part of his scheme. He is in federal prison, awaiting sentencing.

There is no indication that McAuliffe or other investors were aware that patients, recruited through hospices and a Catholic newspaper, were sometimes duped into participating. McAuliffe has called himself a “passive investor.”

But at least some investors knew that they were betting on the lives of specific, dying individuals, according to two of them — a former judge and a Hollywood producer.

“There was certainly full disclosure to my law firm when we chose to invest in this,” said Robert G. Flanders Jr., a former Rhode Island Supreme Court justice who, for a time, defended Caramadre in a civil suit that insurers brought against him.

A campaign spokesman declined to say whether McAuliffe also knew of the basics of the investment.

“At the time that he invested, he was told Mr. Caramadre was a respected figure in his community and that he was led to believe that he was investing in a legitimate pooled annuity,” campaign spokesman Josh Schwerin said in an e-mail.

The ghoulish quality of that investment could add to the impression — created by his long history of controversial business and political schemes — that McAuliffe is an unscrupulous dealmaker. But it is complicated enough to make it difficult to understand — and to determine what exactly McAuliffe knew about it.

Caramadre used his knack for contract nitty-gritty to hatch a scheme that allowed investors to receive a stranger’s death benefits. With traditional life insurance, someone has to have what is called an “insurable interest” to take out a policy on someone else — they have to stand to suffer financially in the event of the person’s death. Typically, it is not possible to have an insurable interest in a stranger.

Caramadre noticed that the rule did not apply to certain annuities. And there was no requirement to submit to a health exam. Further, because the annuities guaranteed a minimum return, investors could play the stock market risk-free. If the investment went up, the investor reaped that profit. If it went down, he still got his initial investment back.

Under Caramadre’s scheme, an annuity would be created in the name of a dying person, listing the investor as its primary owner. When the annuitant died, the investor could cash out the policy or let the investment ride the stock market for a number of years without fear of losing money. For a fee, some policies awarded investors double the death benefits.

“There were riders and other ways you could bump the profitability of these things by paying a little bit extra and getting double death benefits,” Flanders said.

McAuliffe’s connection to Caramadre came to light about two weeks ago, as his race against Attorney General Ken Cuccinelli II (R) entered the home stretch. According to court records made public then, McAuliffe’s investment paired him directly with the ailing mechanic, with forms identifying them as acquaintances. McAuliffe’s campaign said the candidate did not know the mechanic and doesn’t know why they were listed as acquaintances.

Two days later, Cuccinelli’s campaign had a TV ad that said McAuliffe was preying on people on their deathbeds.

McAuliffe moved quickly to try to put the controversy behind him, making a charitable donation of $74,000, an amount representing the $47,000 he says he reaped from the deal as well as a $27,000 donation Caramadre made to the Democrat’s failed 2009 bid for governor.

But the episode still opened a wider window onto how McAuliffe came to invest with Caramadre in 2006 — and provides yet another example of how the former chairman of the Democratic National Committee has mixed business with politics.

McAuliffe made the investment on the advice of Mark Weiner, whom McAuliffe describes as a “longtime party supporter and close friend” in his autobiography, “What a Party!” Thanks to McAuliffe, Weiner is the “tchotchke king of the Democratic Party,” as a fellow Rhode Islander put it.

A committee McAuliffe co-chaired in 1997 gave Weiner exclusive rights to sell commemorative coins, T-shirts and other merchandise to mark President Bill Clinton’s second inauguration. At Weiner’s suggestion, McAuliffe even hawked the stuff on the QVC television shopping channel, a sales job he describes in his book as “probably my lowest moment in American politics.”

Nearly a decade later, Weiner connected McAuliffe to Caramadre.

McAuliffe’s campaign confirmed that Weiner put him in touch with Caramadre. Weiner, who has given $85,000 to McAuliffe’s two campaigns for governor, was seriously injured in a car accident in Florida in August and is in no condition to be interviewed, said his wife, Susan Weiner. When asked about McAuliffe and Caramadre, she said she knew nothing.

Caramadre, who hosted a fundraiser for McAuliffe in 2009, also was a big political donor. A Catholic known to wear a large wooden cross around his neck, he hoped to tap his political connections to become his country’s emissary to the church.

“One of his dreams was to be an ambassador to the Vatican,” said Donald Kushner, a Providence, R.I., native and Hollywood producer who met Caramadre and invested with him when he returned to his home state to make a movie.

McAuliffe’s spokesman confirmed that he was aware of Caramadre’s Vatican aspirations.

“Terry heard that it was his dream but never offered to help in any way,” Schwerin said.

Flanders said the scheme benefited everyone.

“This wasn’t a [Bernie] Madoff thing where people were losing any money,” Flanders said. “They were all thousands of dollars richer for having met Mr. Caramadre.”

Said Kushner: “I guess you could consider it a little ghoulish. . . . [But] listen, if I was a hospice patient and I was broke, and somebody offered me $10,000 to sign some papers and I could give the money to my nephew who needs tuition next year, I would think it’s a good thing.”

Not everyone took such a sanguine view.

“You think about it, it makes you sick to your stomach that human beings can prey on somebody else’s illness,” said the sister of the mechanic McAuliffe invested in.

Although the mechanic is listed in public court documents, the woman spoke on the condition that her name and that of her late brother not be used in this article to avoid upsetting relatives.

The woman said her brother had battled cancer of the head and neck for years. His insurance benefits from his mechanic’s job had been exhausted when Caramadre offered help in the form of cash.

“Medical bills, burial — if you even wanted to use it to buy a new car, they didn’t care,” the sister said.

Someone working for Caramadre went to the mechanic’s house in early November 2006, when he was confined to his bed, rising with assistance only to use the bathroom, the sister said. He signed some papers and got an envelope filled with cash, the sister said.

The amount was $5,000, the mechanic’s widow said in an affidavit. He died early that January.

The sister said the money seemed like a godsend until years later, when the FBI alerted the family to the scheme.

Although the sister was angry, the mechanic’s widow was not. She filed an affidavit on Caramadre’s behalf, saying he’d provided a “gift.”

“I suffered no damages or financial loss as a result of Mr. Caramadre’s investment program,” she said in the affidavit.

She even referred Caramadre to her father-in-law, an 81-year-old retired carpenter, who died about six months after his son. The sister said the family agreed to the second deal only because they did not understand what was going on.

“When you’re grasping at straws and overwhelmed by grief . . . you just don’t think straight,” the sister said.

“We all sat around the dining room table. . . . [Caramadre’s representative] went through his spiel with us. My father said, ‘This is just too good to be true. I don't get it.’ ”

Eventually, the carpenter signed the paper, and the man handed him a sealed envelope with cash inside.

“He said, ‘If you want, you can count it,’ ” she said. “And my father, being an old-time person, opened it up and counted it.”

There was about $10,000, she said.

There is no indication that McAuliffe was involved in the second deal. It is not clear how much he made on the first one with the mechanic.

His campaign said he invested $33,000 and received $80,000 back, netting $47,000. Federal prosecutors said in court documents that McAuliffe was given $113,000.

McAuliffe did not list the investment on financial disclosure forms filed with the state during his 2009 campaign, when the investment was still active. His campaign said that was on the advice of his attorney, Joseph Sandler, former staff counsel for the DNC.

The campaign declined to say why Sandler thought the omission was appropriate. Sandler said he could not provide his rationale without permission from McAuliffe.

Eddy Palanzo, Magda Jean-Louis and Jennifer Jenkins contributed to this report.