Note that not all Mersenne numbers 2^p-1 are primes (even if they are not powers of 2, nor multiples of power of 2, like aligned addresses)
But it's true that the lower bits of aligned adresses have no use in the final hash and could be stripped before using the modulo. But then the stripped address may be a multiple of the Mersenne if the Mersenne is not prime.
For example 2^16-1 is a multiple of 5, so addresses that are 5 times the alignment size for addresses will collide frequently in a table with 2^16 nodes.
The only way to avoid this is to multiply the stripped-down address (converted to integer without the low bits always equal to 0) by a large enough **non-Mersenne** prime like 0xAAAB to "randomize its bits", and then use that result as the hash value of the address.
You DON'T need the (modulo tablesize-1), just the (modulo tablesize) for converting the hash value to a main slot number in the table, like for all other hashes, i.e. just need to mask the high bits if the table size is still limited to a power of 2: that is something that should change for large tablesizes as this is a severe limitation that wastes memory but which is still applicable, given your comment saying that tablesize-1 is a Mersenne (this should not even be true if this limitation of tablesizes=2^p is removed above some value of p, where tablesizes could just be a multiple of 2^p).
This multiplication by a large non-Mersenne prime will also work even if addresses of objects (tables, functions, or userdata whose mutable content is not hashed at all) are not aligned at all (on 8-bit systems that have no alignment constraint at all, but follow some incremental patterns with many multiples of the same base and a constant offset (this occurs when allocating many objects of the same size): the differences of addresses, ie. the base could easily be a small multiple or submultiple of the (tablesize-1) which is most often NOT a prime and may have small divisors.