Long long ago, a TTL input (for a simple example the 7400) was the emitter of an NPN transistor.
The base of said transistor was pulled up to Vcc (typically 5V in those days) by a resistor inside the chip.
Grounding the input connected the emitter to 0V and turned the transistor on.
Leaving the input floating or connecting it to 5V (usually via a resistor) turned the transistor off.
You can find the schematic of a TTL gate in old datasheets.
Since the input was relatively low resistance, there were none of the problems of CMOS inputs where allowing the input to float is a definite no no...