Is it illegal or unethical for a publishing company to pay in exchange for including a co-author?
It sounds not ethical to me; if it is legal or not you should ask a lawyer;

Consider the following point: This is definitely at least borderline to scientific misconduct (depending if the co-author actually contributed anything at all), and either you will have to publish in a journal with bad reputation or risk retraction if you publish in any journal caring about it's reputation.

And if your PHD gets delayed (and possibly stalls as a consequence of resulting bad relationships with your team/university), anything which you possibly got from it will turn out not to be worth it.

(As a small side remark: Academic life often forces you to walk the line between ethical and not ethical very carefully. But don't participate in anything like this on your own will)