How do I make a boxed extrusion on a cube that has a subdivision surface modifier?
Select the end face, and the four edges. Next press Shift+E to crease the selected edges.
You can also crease the edge loop at the base to make the extrusion like a cube. This method works mostly the same for extruding inwards as for extruding outwards. You may need to crease more edges, especially those on the face.