What is the purpose of connecting the collector of an NPN to the base of another NPN?
As you noticed, this is a TTL logic inverter.

When A is floating or pulled to high logic state, the leftmost transistor cannot operate as transistors normally are used. But its BC junction gives the Vcc through the 4kOhm resistor to the second transistor. When A is pulled to GND, it sucks off what was the base current of the 2nd transistor. Also stray and junction capacitance in the 2nd transistor get discharged effectively.

The benefit: Nothing in this (=inverter) case, simpler driving could as well be functional. But the principle makes easy to add more inputs for gate operations such as NAND. Inputs like this in a gate do not disturb each other. Of course the inverter also has got the same input for consistent logic-family wide input characteristics.