I don’t think that this type of settlement money is illegal.
Non-disclosure agreement or “hush” money?