Remembering this would put a stop to 90% of legal "discussions" on HN.
A police trooper pulled me over for ~80 in a 65 (deserted highway at night). He somehow transposed the last two numbers in my license plate, so I obviously assumed I was home free. Until, while I was on the stand, the judge just looked at me for about 10 seconds, said "Were you driving the car?" "[pause] Yes, your honor." "[gavel slam] Guilty."
It's the other situation where law stops being code. If you do something that is technically illegal but probably oughtn't be then the law can be reinterpreted in your favor.
Assuming you followed the absolute letter of the law with your totally-not-a-brothel then you would be fine (until the law is amended).
Select parts of laws may have the rigor of a programming language, but the greater portion expresses things for humans, with human ambiguity.
"money or its equivalent"
"offers"
"adultery"
"fornication"
etc.
The law is written in terms of broad concepts that a judge can interpret. In most cases there is no such thing as "absolute letter of the law", partly because English makes that impossible, but mostly because legislating such strict specific definitions would be a bad idea. I think the impossibility of bug-free software makes it clear that we wouldn't want laws written like code.
I'm not sure your example was the best for showing there aren't loopholes based on overly literal interpretations, given that the tax code is notorious for them.
I hope the point was clear though, that the "spirit of the law" is a real thing, and most clever loopholes will not work with a human judge.
There is a gift tax, but it's paid by the donor, and they can give up to the annual exclusion amount a year without hitting it. This year, the limit's $14,000.
Once a gift goes past that for the year, the excess starts counting against the donor's lifetime exclusion and needs to be reported on the donor's taxes. Gift taxes come into play once the lifetime exclusion limit is exceeded, and it's $5.4 million.