Technically there is no tax consequence since the buyer only gets back some of the basis he contributed.
This type of transaction if perfectly fine if the lender is aware of the cash back. The fraud is the hiding of the cash back from the lender. The lender funded a loan based on certain truthful information provided. If you lie to the lender that is fraud.
The loan officer generally doesn’t work for the lender. He gets points (commissions) based on the loan product that he sells.