The justices held that President Donald Trump’s reelection campaign, which was acting as an intervenor in the matter, was pushing for ways to reject ballots that did not appear in the statute.