Firstly, he doesn't say that understanding COBOL and BASIC is a crime: he says that teaching COBOL and BASIC should be regarded as a crime. And he lays out why: he says that exposure to those languages causes some kind of mental damage, so he is likening the teaching of them to the intentional infliction of an injury. Clearly this is tongue-in-cheek - it is highly unreasonable to infer that he literally wanted the teaching of two programming languages added to the criminal code, because this is absurd on its face.
The intended takeaway is that there are habits of thought learned by use of BASIC or COBOL that are must be unlearned to think about programming problems in that way that Dijkstra recommends.
He puts this statement in a list of very serious statements, most of which are actually true, claiming:
Nearly all computing scientists I know well will
agree without hesitation to nearly all of them.
That sure as heck doesn't sound toungue-in-cheek.