A friend told me about a hardware piece which protects the hard drive from saving changes made to it, so that when the computer is rebooted it remains the same as it was the last time. Does such a thing exist?
Yes, it's called a write-blocker, or more officially a "forensic disk controller". The hardware doesn't cache any writes; it simply mounts the disk as completely read-only, with no physical way to write data to the disk.
If what you're looking for is a way to run an OS more traditionally with write capabilities, but restoring to a previous state after you reboot, then the best way to do that is with a live CD image. Alternatively you could set up a VM on read only storage, then boot into that. This could be done with read-only media like a CD or DVD, or with writeable storage through a write-blocker, or with a storage device which has a physical read-only switch.
While @Polynomial's answer is correct, I think what you are looking for is actually software-based. Companies such as Faronics make products (like Deep Freeze) that do not store changes to the disk once the disk is frozen. You need to reboot into a thawed mode to make any changes that you want persisted between reboots, otherwise any changes made to the OS / filesystem are purged during reboot.
Companies like Apple use products like this on their demo systems in the store and simply reboot the machines each night to return to the intended configuration.