Here’s one way to dodge the taxman—buy thousands of losing lottery tickets.

It’s true. Gamblers have concocted a scheme to repurpose the dud ducats to offset their winnings. A winner can go online and get $5,000 worth of losing lottery tickets to cover their $5,000 in gambling winnings. The lottery tickets serve as a sort of security blanket if the auditor comes calling.

Ads captured on Craigslist and eBay from Florida to California hawk the tickets so the potential lotto buyer can defraud Uncle Sam.

A Detroit-based seller was getting rid of $10,000 worth of scratch-off tickets for $500. “So ya don’t look like a xxxxx :) come tax time,” the ad reads.

One Jersey Shore seller snapped a picture of $1,100 worth of Daily 4 and Mega Millions game tickets with the pitch: “Good for tax writeoff for your 2014 taxes to offset your winnings.”

And after an inquiry, a vendor in Los Angeles said of his $192 in lottery tickets, in denominations from $2 to $20: Yes, “you can use them for taxes.”

“There is a gray market out there for these lottery tickets,” said Reece Morrel Jr., an Oklahoma-based CPA who files taxes for some high rollers and oversees the online Lady Luck Diary website, where gamblers can get schooled on tax laws.

But hoarding stacks of scratchers or Powerball game tickets to prove that you suffered losses could very well land you in trouble with the IRS.

Possibly the first prosecution for this type of fraud was of none other than an accountant. Actually, he was a former IRS revenue officer named Henry A. Daneault.

In 1985, his client Phillip Cappella won a $2.7 million jackpot from the Massachusetts State Lottery Megabucks game.

When Daneault was retained to do Cappella’s taxes, the pair got greedy.

The accountant decided to claim that his client had suffered $65,000 in losses for the year, and the IRS flagged the case.

Daneault had to think fast to substantiate the $65,000 write-off.

In a pinch, he paid $500 to a Massachusetts man named William Jenner to rent $200,000 worth of losing lottery and racetrack tickets for a month.

The accountant sent a few employees to load a pickup truck’s bed with the tickets bound in stacks of 100 and gave his new partner a receipt and a promise to return the tickets.

Both Daneault and his lottery-winning client Cappella pleaded guilty to tax fraud charges and served time in prison.

Reached by phone, Cappella told The Daily Beast he’s moved on. “It was a lot of crap and I just don’t want to be re-experience it,” he said.

Daneault’s attorney, James Krasnoo, said the case was a first for him. “I never had one where it involved fake tickets, meaning losers being used to offset wins," he said.

The lotto rental ruse is still in play today.

Small-time businesses apparently rent losing lottery tickets to sneaky citizens, Morrel said. Some, he said, will lend them to a customer for three months. And in that time, if the taxpayer is audited, those lottery ticket investments are meant to justify a write-off.

“There’s companies set up today to rent losing lottery tickets just for your audit,” Morrel said.

He acknowledged that his gambling clients are often in the dark about the tax rules that govern their winnings. “A lot of gamblers are confused as to how much they can write off for federal purposes,” he said.

The rule is this: Whatever losses you incur can be deducted from your winnings but “may not be more than the amount of gambling income reported on your return,” according to the IRS.

So if you banked $100,000 and suffered losses of $10,000, you have to pay taxes on the difference, or in this case $90,000. So there is an incentive to write off a substantial sum in losses, thereby offsetting the taxes you pay. Ideally, you can write off, say, $50,000 in losses, and that would mean you only have to pay taxes on half of the winnings.

That’s where some desperate schemers start dreaming up ways to increase their loss totals so that they can shell out less money to the taxman.

And they don’t just stick to lottery tickets. Those horse racing tickets tossed on the ground without a second thought aren’t trash. Some enterprising scavengers take pains to vacuum them up.

But any IRS agent doing any fact check will sniff them out. “On the ticket they will put the day and time and window,” Morrel said. “A smart IRS agent will catch this and say to the person, ‘You’re faster than the thoroughbreds.’”

But the IRS isn’t likely to make a fuss about lottery tickets, said Nelson Rose, a professor at Whittier Law School and author of several gambling books. “If the IRS or the FBI really cared, they could go after [all] the people buying and using them to evade taxes by saying they’re losses.”

And not every lottery-ticket seller on Craigslist is trying to collude in gaming the IRS. Many ads posted seem to be above board, including those selling tickets for memorabilia. Those vendors are pretty much in the clear, Rose said.

But if a paper pusher is aware of a buyer’s scheme to shortchange the IRS, then like the getaway driver in a bank heist, he or she could face fraud charges. “If you sell something and there’s no legitimate use or sell an excessive amount where there may be legitimate use, there is the potential for being guilty of tax fraud,” Rose said.

Better to stay away from buying boxfuls of these game pieces.

“You are going to run into trouble explaining why you have $25,000 worth of losing tickets from another state,” he said. “There’s no legitimate use for them."

Keeping a diary can also end up being the difference between having a heart-to-heart with Ira the IRS man and enjoying Spring Break in Cabo San Lucas. “There’s good reason to keep a diary,” Rose said. “For tax purposes, if you come into big winnings in December, how are you going to remember what you lost in February?”

Alex Traverso, a spokesman for the California Lottery, the third-largest in the country, told The Daily Beast that the practice of stockpiling losing stubs and submitting them to offset winnings is harebrained. “Sure, every bit helps, but are people willing to go through the effort it takes to authenticate that the losses they’re claiming were actually theirs and not someone else’s?” he said. “Are people willing to risk an audit? My sense tells me that most wouldn’t be.”

He emphasized that his agency “strongly discourages” anybody from selling or buying losing tickets for tax purposes.

In terms of enforcement, Traverso said the onus is on the IRS.

North American Lottery Association President Terry Rich agreed. He told The Daily Beast that he advises against anybody trying to save money by buying and then writing off losing lottery tickets. “Whenever agencies like ours deal with big dollars, there is going to be people who take advantage of the system,” he said. “We want to make sure people adhere to the law. In this case, we suggest people talk to their tax attorney or the IRS.”

The Daily Beast asked the IRS to inform it about the lottery ticket loophole. As requested, this reporter promptly submitted a set of questions to the tax agency. In response, the IRS sent back bone-dry links to its website that barely touch on how to report gambling losses.