Pilot here. There's two things at work here.
When the airplane taxis onto the runway and sits, it's because the tower told the aircrew to "line up and wait". The controller can't clear the aircraft for takeoff yet due to spacing or aircraft operating on an intersecting runway, but wants the airplane in position and ready for takeoff without delay.
When the tower says "cleared for takeoff", the controller is authorizing the aircraft to take the runway and depart. The plane can either be on the taxiway or lined up and waiting. In either case, the pilots are authorized to do whatever is required to get the aircraft into takeoff position, take the runway, take off, and climb out in accordance with the departure procedure authorized.