As someone who practiced law for almost 25 years before becoming disabled, you are incorrect; this is exactly how our legal system works. Lawyers, businessmen, and such, always look for loopholes. Statutory definitions are the best way. For example, how does a statute prohibiting the sale of some product define "sale," or "compensation." If whatever you do does not meet the definition of a "sale" in the statute, it is not a sale and is not prohibited - at least by that statute. Does that mean that sales disguised as something else would be legal? No, particularly blatant examples such as pretending you are selling the bottle and not the beer inside.
As a concrete example, here in Oregon, ORS 471.401 provides that a license is required to brew alcoholic beverages. Subsection (4) of that statute provides the following exception: "A person may make homemade beer, wine and fermented fruit juice as authorized under ORS 471.037. A person may provide assistance to another in making the homemade beer, wine or fermented fruit juice, if the person does not receive financial consideration as defined in ORS 471.037 for providing the assistance."
You then have to look at ORS 471.037 to determine what constitutes "financial consideration." "Financial consideration" is defined as "value that is given or received directly or indirectly through sales, barter, trade, fees, charges, dues, contributions or donations," but there are a number of enumerated exceptions, including "eer, wine or fermented fruit juice ingredients." ORS 471.037(1)(B)(v). Therefore, in Oregon brewing for another person in exchange for ingredients would not be illegal. Oregon law also provides that the Liquor Control Act does not apply to beer made for "noncommercial" purposes. The definition of "noncommercial" is tied to "financial consideration." The Act also does not apply to "the noncommercial consumption at any location of homemade beer, wine or fermented fruit juice." Therefore, under Oregon law, a homebrewer could brew beer to be consumed off-site at a wedding in exchange for ingredients without violating the law. The issue of the premises liquor license being effected is another question.
Lesson - it is important to read the exact language of the law at issue. (And this is not intended as legal advice; I am not your lawyer; I am not even a licensed lawyer anymore.)