This is a question for an actual lawyer. Most give free consults, so consulting under the guise of a prenup request (which rarely hold up) might be a free way to get a professional in your state to chime in (and if nothing else would help refine search terms).
It’s not illegal afaik. Federally at least, sham marriage laws mostly only care about immigration purposes.
I’m not sure of the intricacies, but if the friend takes on new debt after the marriage you’d also be on the hook.