The ruling laid bare sharp differences between the judges appointed to the court by Democrats and its ascendant conservative majority, bolstered by four judicial appointments of President Donald Trump.