The Miss United States of America pageant can, under the First Amendment, exclude transgender women from participating, a federal appeals court has ruled.