The stated purpose is of course to reward frequent travelers and to encourage them to remain loyal to a favorite airline.
The hidden purpose is to get corporate travelers to maneuver around the restrictions of their corporate travel policies to fly a particular airline regardless of the fare. The airlines have stuck to the policy that the miles belong to the traveler, not to the company that buys the ticket, to keep the travelers loyal even when the company is not.