NEW YORK – While building up savings offers the best route out of poverty, the glamorless grind of socking away a dollar here and there has a tough time competing with the heady fantasy of a Mega Millions jackpot. But instead of attacking lotteries, a growing number of credit unions and nonprofit groups are using them to encourage low-income families to save.

These accounts essentially treat every deposit as a ticket in a prizewinning raffle. The idea is to offer the thrill of gambling without the risk. Even perennial losers keep their savings.

The use of prize-linked savings accounts has won support from a rare combination of liberal poverty advocates and conservatives who like the private market-based approach and emphasis on personal responsibility. In Congress, bills to modify federal banking laws and permit more financial institutions to offer prize-linked accounts have Republican and Democratic co-sponsors. And several states, including Indiana, Connecticut and New York, have recently modified their banking laws to allow credit unions to offer such programs.

The accounts make up a small part of the savings universe, but they are slowly gaining traction.

Doorways to Dream, a nonprofit organization based in Massachusetts, helped start Save to Win in Michigan five years ago. It is now the nation’s largest prize-linked savings program, having spread to Nebraska, Washington and North Carolina. The program has created 50,000 accounts that saved a total of $94 million, although not all of them are still open, according to the nonprofit.

With Save to Win, account holders buy shares in one-year certificates of deposit, or CDs, at a participating credit union. (Federal law prohibits banks from holding lotteries or raffles.) For every $25 share, they receive an entry in a monthly lottery.

“I didn’t have $500 to start a CD, and when they said it was only $25, I knew I could do that,” said Cindi Campbell. “I got addicted when I won $100, and I was thrilled to death.” She made those remarks when she was awarded the $30,000 grand prize at North Carolina’s Telco Community Credit Union in February.

One of the goals of such programs is to help change financial habits.

Economists have long complained that lotteries are lopsided taxes that eat away at poor people’s ability to save, noting that those with the least money tend to spend the most on lottery tickets.

Policymakers also worry that saving too little is a problem not only for the poor but also for many baby boomers who potentially face decades of retirement without sufficient resources. The nation’s current 5.3 percent savings rate – the proportion one saves out of total disposable income – is higher than before the 2008 recession but about half what it was 40 years ago.

Save to Win is open to anyone, but the program’s director, Joanna Smith-Ramani, described most depositors as “financially vulnerable,” with either low incomes or no history of savings.

Gail Miller, 73, a retired Piedmont Airlines worker who lives outside Winston-Salem, N.C., said the prospect of winning a prize persuaded her to open a Save to Win account. She makes a $25 deposit 10 times a month – the maximum number of entries – to increase her chance of winning. In May, she won $25. “It was the first time I won,” she said, “but I keep trying.”

People with Save to Win accounts may withdraw money to buy Christmas gifts or fix a broken car, Smith-Ramani explained, but most then build their balances back up. “That kind of pattern and activity is more important than the total number of account holders,” she said. “People are learning how to save and to forecast. That’s a huge psychological shift.”