I now have an ice-cream headache.........Sometimes some of the airport codes have a little bit of history hiding in them. For example Chicago O'Hare is ORD because it was originally called Orchard Field. Orlando International is MCO, because its original name was McCoy Field.
Sometimes having the Amtrak station code for the city station being different from the airport code works out well. For example, Newark NJ, where the Amtrak station is NWK and the airport is EWR. When the Newark Airport Station was built it naturally got the code EWR. Can you imagine the headache it would have been if Newark Penn had the code EWR? BTW the ICAO code for Newark Airport is KEWR. Indeed in most cases you can get the ICAO 4 letter code for an US airport by pre-pending a K to the 3 letter IATA code for the airport.
Many Amtrak stations have their own IATA codes too, specially those that have code share service between Amtrak and an airline (typically Continental).