Since joining the Supreme Court after President Obama nominated her, Justice Elena Kagan has voted his administration’s way about 49 percent of the time. Most justices agree more frequently with the presidents that nominated them. (Michael Dwyer/AP)

If you are a justice of the Supreme Court, there’s no president like your first president.

Most members of the court make more decisions favorable to the president who brought them to the dance than they do to subsequent presidents, even those of the same party, according to a new study by two prominent Supreme Court experts.

The law professors say what they call the “loyalty effect” is evident even when other factors such as ideology and a personal relationship with the appointing president are taken into account.

“However, the loyalty effect is much stronger for Democratic justices than for Republicans justices,” write Lee Epstein, of Washington University in St. Louis, and Eric A. Posner, of the University of Chicago.

That means that Democratic justices are less likely to vote for subsequent Democratic presidents, while the rate of variance for Republican nominees and subsequent Republican presidents is not as pronounced.

Epstein and Posner wrote that their study, Supreme Court Justices’ Loyalty to the President, came from an interest “in loyalty — and a related phenomenon — gratitude — in politics, an understudied topic.”

Posner said in an interview that he began thinking about when the court — with two members appointed by President Obama — considered the constitutionality of the Affordable Care Act.

The usual explanation for how a justice votes is ideology, Posner said. “But it’s hard to imagine a justice recently appointed voting against a major initiative of the president.” (As it turned out, Justice Elena Kagan went halfway, upholding the law’s constitutionality but voting against a major Medicaid feature of it.)

Judicial independence is a mainstay of American democracy, but politics plays a vital role in how a justice gets his or her job. Presidents look for those with similar views and values. A president, after all, can serve no more than eight years, while his nominees to the court stay for decades.

Chief Justice John G. Roberts Jr. alluded to the process in a short speech at the White House after he took the oath in 2005.

He thanked President George W. Bush for selecting him and praised the team at the White House for skillfully guiding his nomination. He thanked the senators for how they comported themselves and for approving his nomination. And then he said he looked forward to getting to work heading the third branch of government and the one that would pass judgment on the president’s actions and the Congress’ laws.

Because they are supposed to be independent, the justices fret about appearances. Epstein and Posner quote former chief justice William H. Rehnquist as contending that “institutional pressures” within the court “weaken and diffuse the outside loyalties of any new appointee.”

Retired justice John Paul Stevens once said that “the political aspects of a federal judge’s career should end when his or her nomination is confirmed.” He refused to attend White House swearing-in ceremonies of justices, although as the acting chief justice he presided when Roberts took one of his oaths of office — there are two for federal judges — at the White House.

In theory, a justice owes nothing to his or her political benefactors — the lifetime appointment can be revoked only through a cumbersome impeachment process.

But Epstein and Posner supposed there had to be some sort of loyalty. They studied the Supreme Court appointees of presidents from Frankin D. Roosevelt to Obama, covering the Supreme Court terms of 1937 through 2014. They examined cases in which the president, a federal agency or an executive branch actor such as the attorney general was a party.

All but one of the justices examined voted at least a majority of times for the appointing president, with the mean being about 65 percent of the time. But again, Kagan emerged as the anomaly in the study.

According to Epstein and Posner, Obama’s former solicitor general has voted his way only about 49 percent of the time. But the data for Kagan is more limited. She came onto the court just before the October 2010 term commenced, and she recused herself in 17 of the cases that were studied because of her previous government work. If she had voted Obama’s way in those cases, she would be closer to the mean, they said.

Next, the professors looked at whether justices voted for their own presidents more than for subsequent executives. Most did, although two — Chief Justice Earl Warren, nominated by President Dwight D. Eisenhower, and Justice Tom C. Clark, selected by President Harry S. Truman — went the other way. “They appear to be ingrates,” Epstein and Posner wrote.

More interesting to the professors was how the justices voted when a subsequent president was of the same party. Democratic justices were less likely to vote for presidents of the same party than they were of the president who appointed them. Republican justices were just about even.

The professors weren’t sure why this was so. Perhaps Republican presidents choose nominees for their ideological commitments, “whereas Democratic presidents choose Democratic justices with a range of other considerations in mind — including general and racial diversity, patronage and the like.”

Still, they conclude, “we are left with more questions than answers.”

On the current court, Roberts and Justice Samuel A. Alito Jr. have not had the chance to vote on cases involving presidents of the same party other than Bush, and Kagan and Justice Sonia Sotomayor have only voted on Obama cases.

Posner said a related finding jumped out: Obama has been on the winning side just about 50 percent of the time, far lower than other presidents.

It can be partly explained this way: The party challenging a lower court ruling, called the “petitioner” at the Supreme Court, has a much greater chance of winning than the party that prevailed in the appeals court, called the “respondent.” In about two-thirds of the cases it accepts, the court rules for the challenger.

The Obama administration has been the respondent in a greater percentage of cases than any administration other than John F. Kennedy’s, the study showed.

That shouldn’t explain everything, Posner said. But it does suggest the next study, he said: “To explain why Obama loses so much.”