It depends. With conventional AWD (like all Subarus), you are correct that there is significant energy loss due to the AWD because there is a drivetrain to the rear wheels, even if it is not delivering power.
Many hybrids, however, have AWD and they work by having a second, small electric motor that powers the rear wheels only when needed. That means no physical drivetrain to the rear wheels, so no energy loss. That's why a hybrid Toyota RAV4 AWD gets about 15% better gas mileage than the smaller and lighter hybrid Subaru Crosstrek AWD.
The disadvantage of the electric motor approach is that it cannot deliver as much power to the rear wheels as a conventional physical AWD drivetrain can. That said, probably only an issue in deep mud or snow.