An employer can pay someone cash money for the jobs they perform but if your earnings are $500.00 or more per month then you must still file income tax and the employer must also file and pay payroll taxes if they pay in cash.
If the employer doesn't report that income that they paid you in cash on payroll tax then that is illegal and why it's called paying under the table.
So while it's not illegal for cash to be paid to you from your employer it is illegal for the employer to not report the income they paid to you on the payroll taxes.