In general, obtaining coupon codes for free online is not illegal. Many retailers and brands offer coupon codes as part of their marketing strategies to attract customers, encourage sales, and reward loyal shoppers.