The front was originally a two piece design. BMW sells a replacement now that integrates the base. The rear was originally a three piece part, with an emblem, base and seal underneath. Here again, BMW sells a replacement that integrates the base and emblem, but does away with the seal.
In both cases, the replacement parts from BMW look quite good.
It is not entirely clear to me whether the gasket was a seal of some kind, or a filler intended to ensure that there were no gaps between the base and the trunk. In either case, as Chris notes, BMW no longer makes the gasket. There was someone offering a replacement gasket, but a couple of us who bought them thought the quality was not good enough. I am attempting to design and print a replacement for this part, but finding the right material/process has been a bit of a challenge.