As long as you purchase from a legitimate reseller, it is legal to buy a discounted Windows key.