Once upon a time, here's how employer retirement savings worked: Companies set aside money for employees' retirement in pensions, also known as defined-benefit plans. These plans typically didn’t require financial contributions from employees, and were funded based on the number of years a worker spent at a particular firm, their salary level, and seniority. When a person retired, monthly checks were waiting for them.

But in recent years the world has shifted, and saving for later in life has become more of an employee's responsibility. The prevalence of self-funded company plans such as 401(k)s, or defined-contribution plans as they are sometimes known, is only a few decades old but total assets held in these plans eclipsed pension plans in 1996, with individual retirement accounts (IRAs), which allow individuals to save separately from their employers, following shortly after. The reliance on employees to set money aside for retirement is concerning because in general Americans are quite bad at it. According to a 2014 report from Boston College’s Center for Retirement Research, more than half of American households were at risk for not having enough money to last them through retirement.

But there's another problem, and that's that many workers are actually tapping into their retirement accounts early. A new working paper from NBER takes a look specifically at 401(k) loan rules that allow workers to take loans from their employee retirement-savings accounts, and the impact that such loans can have on a worker’s financial future. The picture isn't pretty.

Most 401(k) plans allow account-holders to dip into their savings. Financial emergencies, paying off outstanding debt, and a home purchase are all common reasons for doing so. But doing so is generally discouraged by financial professionals. That’s because removing money from your retirement account means that during the duration of the loan, that money isn't growing, which is the main point of having a retirement account in the first place. And failure to repay a loan within the allotted time can lead to default and other financial penalties, like being forced to count the loan as income, and then having to pay taxes on it, which can induce another round of financial hardship.

According to the paper, about one-fifth of defined-contribution plan participants had an outstanding loan during any one period, and about 40 percent had one at some point during the five-year study.

Researchers took a look at the impact of company loan rules and found that those with more lenient policies—such as those that allowed participants to take out more than one loan—had an increased likelihood of people dipping into retirement savings several times. And those multiple withdrawals led to higher aggregate loan amounts versus those plans that allow only one chance to withdraw from savings. According to researchers, that could mean that more flexible plans signal to borrowers that this type of financial move is more acceptable. More flexible plans were also especially troublesome for low-income workers who were more likely to borrow multiple times and default on their loans, the study found.

Timothy (Jun) Lu, Olivia S. Mitchell, Stephen P. Utkus, and Jean A. Young, the authors of the study, found that about 90 percent of those who take out loans manage to repay them—except in the case of those who have outstanding loans when they exit a job. In those instances, about 86 percent of borrowers end up defaulting on their loans. After leaving a company, outstanding loans usually become due as a balloon payment within a short period of time, generally about 60 days. The authors suggest several explanations for the high default rate in such scenarios, including inattention to the loan and lack of knowledge about how these loans work when factoring in a job change. In total the study found that borrowers would up with about $6 billion of 401(k) loan defaults each year.

This is an especially important consideration for younger generations, who may feel less concerned about taking out a 401(k) loan, but are also likely to job-hop, creating a potentially hazardous financial situation. A 2014 research report from Ameriprise Financial found that 17 percent of Millennials had drawn on their employee retirement plans compared with only 10 percent of the Baby Boomers and 13 percent of Gen Xers. And it could wind up costing them in the long run: A 2014 study from Fidelity found that within five years of taking out a 401(k) loan, 40 percent of borrowers had decreased their retirement savings rate, including about 15 percent who stopped contributing to their 401(k) plan altogether. That means that what started as a seemingly easy, cheap loan to get you through a tough time could wind up derailing your finances for years to come.