there are at least 3 reasons/ways they may be able to tell.
1) Schools typically do not check prereqs for fulfillment until you have taken an offer of acceptance. At that time you will be required to submit transcripts directly to the school. Some schools will have these transcripts verified via NSCH. some schools in that database may have identifiers for section numbers, that may be on your transcript, and identify online sections
2) most medical schools will do some sort of spot check on their incoming class that may include contacting registrar, which get this info
3) from the moment you apply to a school, you have agreed to follow student handbook and policies. If you take up an offer of acceptance, you will have attested at least twice, on secondary and matriculation agreement, that you are following listed requirements and are not knowing saying otherwise by signing this.
The risk here that if for some improbable reason you are discovered say as an MS3 to have knowingly mus-attested to an online course, thus an ethical violation, you could have your acceptance retroactively rescinded and thrown out. You could also have federal civil actions from the DOE
I know of a couple of cases like this over the past several years, usually for more serious misrepresentations but still just for coursework issues
Besides the obvious ethical issues, the risks arent worth it