The answer to the question, "Where does Congress get that authority?" is always the "Commerce Clause," which grants Congress the power "To regulate Commerce with foreign Nations, and among the several States..."
While the Commerce Clause has been used excessively broadly (the Supreme Court interpreted it to allow the federal criminalization of marijuana, for example), this actually seems like a case where there is a genuine (and massive) effect on interstate commerce. Just look at how much shopping is done over the internet nowadays, almost always delivering goods to someone outside of the state.