By providing free equipment to schools Apple hooked several generations of people on Apple’s stuff.
As the Apple’s Mac OS X and iOS does not install on non-apple hardware, when faced with a learning curve people do not bother to switch to Linux or Windows and keep over-paying for comparable hardware and software.