It's not illegal, most likely it's a violation of the agreement between the manufacture and the distributor. Which if they find out, they will terminate the partnership. The manufacturers recommendation not to sell a salon only product to the public is for liability reasons.
How much does it cost to start a hair care business?
You can start a hair salon business for as little as $1,000, maybe less, or for as much as a quarter of a million. Don't forget that it's a perfectly legitimate approach to start with a low-dollar approach, renting a booth and leveraging yourself into a shop of your own over time.