On the magnetospheric boundary layer and solar wind energy transfer into the magnetosphere