To give some examples to Dale M's answer, Sweepstakes can occasionally be advertised as "Give Aways" since the company in question is literally giving the grand prize away. As an example, most contests, when advertised will (often in a very rushed nature) say that "No purchase is necessary to play" and, if one bothers to read the contest rules, they will describe the method for playing without a purchase. As for buying products with the game pieces available, you aren't paying more for the product or packaging than you would if you bought it when the contest was not in play. The company running the contest is hoping that the contest will spur more purchases thus increasing profits to cover the game's prizes and then some.
A good example as a case study is McDonald's highly popular Monopoly contest which has been running for nearly 35 years and due to the fraud by the third party distributor of the prizes in the U.S. the behind the scenes distribution of the game are well documented (As part of legal requirements, McDonald's cannot run and promote the game. To get around this, McDonald's used a third party contracting company to run the game and they provided the promotion for it as well as backed the prizes. This is quite common and how most companies with sweepstakes contests actually run the contest. The fraud came when the head of security was able to steal the "rare" game winning pieces and hand them out to friends and family rather than see them distributed to the general public. Essentially, the third party contractor was doing the very thing McDonald's was paying them to eliminate McDonald's from even being accused of doing had they run the contest themselves.).
Fun Fact: Wonka's famous Golden Ticket Contest would have been an illegal lottery since he required a purchase of his product to compete. What if Charlie really wanted to see the local iconic factory despite being too poor to afford Chocolate or having an actual dislike of Chocolate as he explained to cover up his lack of embarrassment.
Of course, if we're going to come down on Wonka for legal violations, there's a bevy of problems from
violation of Minimum Wage Laws (Paying Oompa Loompas in Coco beans?!),
violation of
OSHA (pick an accident that befell the children within the plant) and
FDA guidelines (letting a child consume a gum product that clearly wasn't ready for human testing) and
Health and Safety inspectors ("No one goes in, no one comes out" means no health inspectors to make sure that Wonka's candy is being made in sterile environments, though he does make a point that Charlie and Grandpa Joe caused a production delay due to shut down for sterilizing of the ceiling following the Fizzy Lifting Drinks incident AND Wonka is very much distressed by Augustus Gloop contaminating the Chocolate River by drinking from it.).
At least Wonka had the hindsight to immunize himself by contract from any civil liabilities.