Australia's wealthiest person, Gina Rinehart, must part with some of her riches, a court has ruled in a high-profile dispute over her mining empire.