Does TimeMachine compress iPhoto library?
No, it does not compress it, but the size of the library is in fact different:

The iPhoto Library is not a monolithic file, but a so called bundle (a folder disguised as a file). If you call file > Info (cmd-i), then it's size needs to be calculated, it's subfolder and files can be seen by the usual developer tools.

So, from the POV of time machine, or the file system in general, the iPhoto library is a huge folder with thousands of files.

Now comes another issue into play: Storage media are organized in file sectors of fixed size. The size a file takes on disk is not the number of bytes of this file, but the number of sectors which the file occupies by the number of bytes per sector.
The sector size usually depends on the specific file system and media capacity.

Even a 1-byte file takes one sector, so on a hard drive the smallest file size might be 4 KB, on a flash drive 16 kB.

In consequence that means that the sector size of the medium you save to has a huge impact on the overall size of your iPhoto library. I take an educated guess that the sector size of your SSD is bigger than on your backup drive.