A federal judge rejected government regulators’ demand that Apple waive its 30% commission on all in-app e-book sales by third-party retailers, including Amazon, for two years.