The MacBook you have seen has 8GB RAM.
Your iPhone 4s has 512MB RAM (or in other words, 0.5GB).
RAM and Storage space are two separate entities.
RAM is memory that the system can use as temporary storage - you do not actually save anything into it, the system uses it as and when required automatically.
Although your iPhone has 8GB of storage space (NOT RAM), in comparison, the MacBook you are considering has 256GB.