Forgetting there may be local rules the NEC answer is found in 230.70(A)(1)
The service disconnecting means shall be installed at a readily accessible location either outside of a building or structure or inside nearest the point of entrance of the service conductors.
Basically you can go as far as you want outside the building but as soon as you enter the building you must hit a service disconnect.
Some areas allow only a back to back installation (meter can back to back with the panel) with a short nipple between them other areas might let you run 3', 5' 10' inside the building with SE.
Also keep in mind that service conductors encased in 2" of cement or under the slab are not considered 'inside' the building until they emerge from the concrete.
Meaning just as Allan pointed out you could run 50' under the building and still it would be considered outside. (see 230.6 for this)