One issue I see here, that I haven't seen addressed in the other answers, is that even if you were to inform the proper channels, answer the bid and deliver a "rigged" solution, the student might a) still not use it, or b) modify it before submitting. I would imagine a) as a simple case of cold feet, the developer would still get paid, but the student might have a change of heart in the last minute. b) is more interesting, as the student might use just the general idea, a part of the solution, or even feel that it is too advanced and attempt to strip it down by introducing deliberate flaws in order to avoid suspicion that it is not their own work (assuming still that there is no reason for the student to believe that there is anything wrong with the guy who did the work).
The first point is, there is a plausible scenario in which you can't identify the student, but have done their job for them and even gotten paid (I assume that the money wouldn't be kept, but it is the transaction that matters).
The second point is, that in this case, you miss the opportunity to educate. If the student isn't identified, they might try again. Will you do the new assignment again and hoping that this time it leads to student? Also, other students are not deterred from acting similarly, especially after the word gets out that someone put the homework assignment on some webpage and got it done by a freelancer. You can't come into class and tell that you found the ad and prepared a sting operation by doing someone's homework, but the offender eluded it somehow, can you?
So, for the question about ethics, while the initial motive to catch someone red handed is in my opinion ethical, the result in case of failure is unethical (or "more unethical"). If you fail, you did the homework on behalf of a student (which is worse than if someone else did it), you got money for it (whatever you do with it, the student still paid to get the work done, and it got done without consequences by none other than you, that angle matters in my mind), and you didn't deter similar behavior in the future, neither of the offending student nor of the rest of the class. Which side outweighs the other ethically can be debated, but I think it comes at a great risk, and would recommend against it.
Someone might ask: "Should I then do nothing and let them cheat???". If such a sting operation were the only resort, I would seriously consider myself outplayed and do nothing rather than risk being part of it. I would of course keep a lookout when the homework is handed in. I would also proactively tailor the homework so that it depends heavily on the coursework and hope that an outside expert would either have to invest a non-trivial amount of time to familiarize himself with the material (which might be infeasible in terms of cost, however the pay arrangement) or have his solution stand out among the other students'.
As a final thought, consider that if you don't answer their ad, no one else might.