In table-service restaurant that does take-out as a sideline, you're tipping for the extra handling of your takeout order. "What extra?", you might ask.
It likely comes out of the kitchen on plates, as if it's going to a table. There will be someone -- often a waiter working the take-out shift or else a bartender -- that will take everything off of plates and place it as neatly as possible into take-out containers. Then the cutlery, then the bagging.
For places where take-out service is part of their main gig, a lot of that processing is streamlined (food might not be plated, for example). But you're still paying for goodwill and the overall idea that you want to be a welcome sight at a place you like and go to often.
Admittedly, there can be a lot less incentive to tip for take-out when going somewhere you're pretty sure you'll never return. But then if you have the habit, you tip anyway. Maybe (probably?) not as much.