It's totally against the rules. Solo means "sole occupant of the aircraft".
The only way this could have been done is the instructor didn't sign for dual instruction. This is a very serious offence, the details of the school and instructor should definitely be forwarded to the FAA. The examiner checks the logbooks but from the logbook he can't tell whether the guy was really flying solo or not.
When you fill in the application for the checkride form 8710, where you give a breakdown of hours, you sign and declare telling the truth. The instructor has to sign as well, and he commits fraud as well.