Believe it or not, the accepted answer is to use one field in your "junction" table per level.
This has the advantage that you can enforce referential integrity.
CREATE TABLE productLocation(
productID REFERENCES products(productID) ON DELETE CASCADE,
continentID NULL REFERENCES continents(continentID),
countryID NULL REFERENCES countries(countryid),
stateID NULL REFERENCES states(stateid)
Notice the NULL in those references (except productID).