how do gas pump shutoffs work?

Was pumping gas today (a rare occasion cause it means my '65 Hillman has actually been running) and wondering how the pump knows when to shut off?

My initial thought was detecting backpressure in the hose, but the tank in my imp fills through a very short and wide neck, yet the pump still clicks off when it’s full. Obviously, electrical contacts are a no-no, so how do it know???

capn

Cecil covered it.