The president’s brief encounter with Prince William of Wales came a day after the first state dinner of the Biden administration.