State tax is collected when a company has legal nexis in that state. It is generally accepted that legal nexis is when a company has physical presence in that state. This can be a brick and mortar store, or it could be as simple as x number of trips by company employees doing sales and/or support trips in to that state. In some cases it is just holding contracts within that state.
Any of the above requirements of a legal nexis applies to Apple.