Because it has a fuel level meter (you have it even in very old cars but in the analog version)? A small and simple mechanical device checking on which level is the top of the liquid (fuel). This is the same device that signalize the end of the tank extended with a small computer that can compare and store previous and actual level
If I know how much the fuel in the tank was before refill and I compare it with the level I have now the result is obvious.
I remember cars that have no such float support- the fuel level check were done by the stick... long time ago in the far far away country