While building up savings offers the best route out of poverty, the glamourless 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.

They offer what are known as prize-linked savings accounts, which 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.

These accounts have 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 and Connecticut, have 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.