Early last decade, then-President Barack Obama and Congress were in a standoff. Obama badly wanted Congress to pass long-failed comprehensive immigration reform. But allies called for him to do something himself. His repeated response: I can’t. I’m not a “king.” I’m not an “emperor.” The old constitutional law professor wanted to force Congress to do things the old-fashioned, more-robust way. But when Congress continued to stall on these issues, he did something himself anyway — twice. He deferred deportations for groups he had said he didn’t have the power to protect unilaterally.

The lessons of this apparently weren’t learned by his vice president, Joe Biden, and Biden’s new administration. Or, if they were, the lesson was apparently that it was a gambit worth repeating.

But it’s a heck of a way to do the country’s business. And Biden arguably took it even further than Obama.

Amid pressure from congressional liberals including Rep. Cori Bush (D-Mo.), who demonstrated by sleeping outside of the U.S. Capitol for four nights, the Biden administration reversed course Tuesday and moved to effectively extend a pandemic-era eviction moratorium. Just the day before, a top administration official had said they had looked hard and hadn’t found a legal avenue to do such a thing.

The previous moratorium had lapsed a few days previously, and the administration wanted Congress to do something about it. And they had good reason: It appeared that Congress had to do something. That’s because Supreme Court Justice Brett M. Kavanaugh wrote in June that there must be “clear and specific congressional authorization” for extending the moratorium. That language wasn’t in the short emergency order, but Kavanaugh joined with the court’s three more liberal justices and Chief Justice John G. Roberts Jr. in providing the five votes necessary to keep the moratorium in place at the time.

There is a school of thought that maybe the coronavirus situation has changed enough — especially with the emergence of the delta variant — since Kavanaugh wrote what he did in late June. But even in voting to allow the moratorium to stay in place, Kavanaugh said the Centers for Disease Control and Prevention had exceeded its authority. He just decided it was more expeditious to let a program that was soon to expire come to its conclusion. CDC Director Rochelle Walensky said around that same time that the extension of the program through the end of July was “intended to be the final extension of the moratorium.”

Others have argued that the new moratorium is more targeted and thus could pass muster — or even that there might be some wiggle room in the Supreme Court’s ruling. Only time will tell.

But none of these were arguments that the White House previewed in recent days. Officials repeatedly pointed to the Supreme Court ruling while saying they didn’t see themselves having the authority to do this kind of thing. They even suggested that pressing the issue could lead to a harmful ruling that might affect other things.

In a written statement Friday, White House press secretary Jen Psaki said: “President Biden would have strongly supported a decision by the CDC to further extend this eviction moratorium to protect renters at this moment of heightened vulnerability. Unfortunately, the Supreme Court has made clear that this option is no longer available.”

Gene Sperling, who is coordinating the federal coronavirus response at the White House, told reporters Monday that an ambitious search for a legal workaround had come up empty.

“On this particular issue, the president has not only kicked the tires; he has double, triple, quadruple checked,” Sperling said. “He has asked the CDC to look at whether you could even do targeted eviction moratorium — that just went to the counties that have higher rates — and they, as well, have been unable to find the legal authority for even new, targeted eviction moratoriums.”

As The Post’s Seung Min Kim put it aptly after the announcement Tuesday, “It appears that the administration has now quintuple-checked.”

Much the same as Obama on immigration, they did pretty much exactly the thing they said they didn’t view themselves as having the authority to do: an eviction moratorium targeted at counties with higher rates of infection. And while seemingly more targeted, it still covers about 90 percent of the country.

What’s particularly remarkable about how this was rolled out was how Biden explained it later Tuesday. He didn’t try to say they had finally found a legal loophole for this to pass muster; he instead suggested that it was a stopgap — something they were doing so the moratorium could live on while the courts sort through the mess.

Asked about it passing legal muster, Biden said he didn’t know but conceded that “the bulk of the constitutional scholars say it’s not likely to pass constitutional muster.”

And then he added: “But at a minimum, by the time it gets litigated, it will probably give some additional time while we’re getting that $45 billion out to people who are in fact behind in the rent and don’t have the money.”

In other words: It might not be legal, but even if it’s not, we’ll get some good done in the meantime. At least Obama tried to claim he hadn’t really flip-flopped, even though he had.

To say nothing of the morality of the moratorium or its necessity, it’s a wonder it ever came to this. Democrats have privately expressed exasperation that the administration requested congressional action so late in the game — on Thursday, on the eve of the moratorium expiring. At the same time, it’s not like the Supreme Court’s posture has been a mystery.

Congress might never have passed something to extend the moratorium, given that it would have required Republican votes in the Senate. But the White House decided to apply pressure anyway, by throwing up its arms and suggesting that it was incapable of acting on its own — even if it meant it wound up questioning the legality of the thing it very soon did.

Just because it said that, of course, doesn’t mean the moratorium will definitely be struck down. (Maybe this really was just about saying things to apply pressure!) But they don’t seem too optimistic. And yet again, we have a White House effectively doing something it suggested would probably be illegal, which is certainly a precedent to set.