Somebody has to pay for the US customs and inmigration officials to stay in Ireland (or Canada), and travel back and forth occasionally. I am not sure if this is the airline or the airport. And space has to be provided at the airport - again somebody must pay.
Plus there are legal issues. Are they allowed to arrest people on foreign soil? A treaty is required.
A similar thing happens between France and the UK. Travelling from London to Paris you go through French immigration at St Pancras, and vice-versa there are British Immigration officers at Gare du Nord. And AFAIK their accommodation in Paris is paid for.
It also happens at the Channel Tunnel and at the ferry ports.