On desktops, like the iMac or Mac Pro, RAM is left powered on during Sleep mode, while other components are powered off to save energy.
Depending on whether you have a desk- or laptop, Sleep mode works a bit differently. macOS also takes time to boot, and any software that starts with your machine has to restart, as well. When you start it up again, everything has to be loaded into RAM. A shutdown first closes all running processes-including the operating system-and then cuts power to your machine. Shutting down your computer and Sleep mode aren’t the same.