Charles Evans Hughes and William Howard Taft both ran for the 1908 Republican presidential nomination. When Taft won, he offered to make Hughes his running mate, but Hughes turned him down to run for re-election as governor of New York. The two men remained rivals in the fissiparous Republican party, so in 1910 President Taft appointed Hughes to the Supreme Court. It didn’t help Taft any, since the party split in 1912, with Teddy Roosevelt running his third-party campaign.
The sequel is also interesting: In 1916 Hughes quit the Court to run for president and lost to Woodrow Wilson in a close race. Then in 1921 Warren Harding appointed Taft to be Chief Justice. He served until his death in 1930, when he was replaced by none other than Charles Evans Hughes.