Greek voters are headed to the polls Sunday for a national referendum on whether to endorse an economic deal that’s no longer on the table.

Welcome to the bizarre world of the Greek economy and the perils of an out-of-control welfare state.

The socialist government of Prime Minister Alexis Tsipras is pushing voters to say “no” — though that would cut Athens off from European Union funding and credit and plunge the economy into deeper chaos.

How did Greece get to this? Simple: Since the return of democracy in 1974, its government has spent vastly more than it took in, with bloated public payrolls and pensions — even as the private-sector workforce, which drives production, remained low. Plus, people get away with just not paying taxes.

For decades, this brought recurring crises — which Athens resolved by devaluing the currency to make it easy to repay its debts.

Joining the Euro removed that option — but Greece didn’t change its ways.

The pension system is the poster-child of the problem: Until recently, Greeks could retire after just 35 years and start collecting 80 percent of their final salary; many went into retirement in their mid-50s.

Today, Greece has only four working people for every three retirees, pensions consume more than half of all government revenue — and the population is rapidly aging.

“Austerity” programs of recent years raised retirement to 62 and cut pensions to 60 percent of income — but it’s not enough.

Since taking office early this year, Tsipras has talked of boosting retirement to age 67 —but only in 10 years’ time. He’s also resisted raising cash by other means. Greece promised to sell off 50 billion euros of state assets by the end of 2015, but has only sold 6 percent of its goal.

Bottom line: By promising to give citizens far more than it can deliver, Athens has accumulated debt so high, it’s literally unpayable. The only question is how it’s going to welch — via EU-negotiated loan forgiveness and restructuring, by total default or by exiting the Euro so it can go back to devaluation.

There’s a real lesson here for places like New York and New Jersey that refuse to address their own public-pensions woes or pare down their reliance on borrowing. Both states are a lot closer to Greece than they’d like to believe.