@ OP
That was part of the User Agreement when you sign up, so it's legal.
A little background around fees on shipping. Years ago, sellers tried to circumvent ebay fee system by selling an item at a very low price $1 and charge a shipping $1000 (for demonstration purposes) because ebay charges fee only on the Sell Price, not shipping fee. To solve this problem, fee on shipping cost was added.