There is a legal doctrine called "quasi-contract," under which a person who receives an unjust benefit at another's expense, is bound to restore the unjust benefit received.
In court, you could argue that the boyfriend volunteered. But, the truth is more like the boyfriend was "in love" with your spouse, and so his judgment was impaired, and he did work voluntarily that he would have otherwise only done for fair compensation. Of course, the boyfriend would have to make that claim and prove it to the court's satisfaction. If he does, he'll win (in my humble opinion). Otherwise, he will lose.
In court, it's not about what really happened -- it's about what the parties can prove really happened. And, that is frequently much different -- which is why court cases turn out differently from how parties believe they should: insufficient proof.
Anyway, that's how it works. I hope this better clarifies the issues for you. Please let me know if you require further clarification. And, please provide a positive feedback rating for my answer (click 3, 4 or 5 stars) -- otherwise, Justanswer retains your entire payment, and I receive nothing for my efforts in your behalf. Note: If you cannot find the rating button on your webpage, please just type in your rating in a response to this note, and customer service will apply the rating for you.
Thanks again for using Justanswer!