1040STf - 520STfm share the same chassis, but they only might share the same mainboard, because there are more than 10 different versions with completely different positions of the chips on the same form factor. See some of them here:
https://www.exxoshost.co.uk/forum/viewforum.php?f=52
520ST uses different chassis, without internal floppy, so it also uses different mainboard formfactor. 260ST and 520ST+ uses the same chassis. Also here are different layouts possible, see
https://www.exxoshost.co.uk/forum/viewforum.php?f=53
260 = 512 kB RAM (originally it was planned with 256 kB)
520 = 512 kB RAM
1040 = 1 MB
4096 = 4 MB (rare prototype, never released)
ST = ST series, they all have the same chipset and capabilities
STe = STe series (e=extended), addional DMA sound hardware, more colors, hardware scrolling, blitter always integrated, additional jobystick ports
+ = additional 512 kB RAM (only 520ST+)
f = internal floppy drive
m = HF modulator
Mega (ST) 1-4 = ST professional version in "pizza box" formfactor, internal floppy, expansion bus, internal DMA port, mostly with Blitter, good keyboard, 1-4 MB RAM
Mega STE = professional version of STE, 16 Mhz, VME slot, internal floppy and HDD, TT style chassis, more serial interfaces
Additional there is TT, Falcon, STacy laptop and STBook notebook.
https://www.exxoshost.co.uk/forum/viewforum.php?f=41