That's why you have to check in when flying, but not when traveling by train
In order to board a commercial aircraft as a passenger, you must have a valid boarding pass. You will receive this at check-in, which can now also be carried out online in many cases. But why can they?