There are many things which distinguish computers which are made from off the shelf parts.
The processor is one component which differs. The A1 and Mac are based on the PowerPC, while "IBM" computers use Pentiums. (Life is more complicated than that, but let's not worry about that.) If you tried to feed a program for a Pentium to a PowerPC, or vica-versa, the computer would see a stream of random instructions and illegal instructions. The OS has ways of identifying their own programs, so that normally won't happen.
But other bits and pieces differ too. The easiest to explain is the firmware. This is usually called the ROM BIOS or ROM. You'll note that both the Amiga and Macintosh use the same processor (the 68k in the past and the PowerPC today), so programs should not look like streams of random instructions. But programs may run code which is stored in the ROM. But the ROM is different on both platforms, so running the program on the wrong platform would result in random ROM calls. The OS has ways of identifying its own programs, so that normally won't happen.
Of course some of the details can be glossed over, which is what happens with OSes like Linux. Now you can run a Linux program on either an Amiga or a Macintosh because Linux programs don't make ROM calls. They make kernel calls (in effect, the kernel replaces the ROM). The kernel also covers up the many minor differences in Amiga and Macintosh hardware, such as which video card or disk controller you are using. Of course you will need a different kernel for each platform, but none of the other software has to be changed.
But the processor is a big difference, and Linux cannot cover that up in the conventional way. Instead, it allows developers to recompile programs so that they will run on any processor, may that be the Pentium, 68k, or PowerPC. These programs have to be written more carefully because there are a lot of low level details which Linux cannot cover up, but it can still be done. It is only thanks to the devotion of many developers that this kind of "trickery" is possible. Most companies try to avoid it, which is why many operating systems are only available for one or two processors.
Hopefully that didn't over simplify things to the point of inaccuracy, but I hope I convinced you that these are very different machines even if the design philosophy is similar in a few ways.