In a minecart, the hopper checks for potential inputs above the rail. Items will be pulled from chests above the rail if they are placed above the hopper. Putting a hopper below the track will produce items, but a minecart can still be pulled with a hopper from a hopper.