@Max's answer is correct, but I'm not sure it makes its point.
The main issue is not that they are collectible but that they are profitable. If the government gives you a $1 bill and you never deposit it, then the government made almost $1 of profit (or seigniorage. which is the term associated with profiting by printing money). There is less of a profit in coins, as they are more expensive to make. But they are more collectible.
The difference between a collectible and a regular coin is that regular money runs around the economy pushing for inflation. But the collectible just sits on a shelf or in a drawer.
There's even an argument that it counts twice. Once as a dead weight profit, and then again when exchanged. Because it is itself a product, its increasing value takes inflation out of other sectors of the economy (e.g. food).
But in the end, the simple answer is probably the easiest to understand. Minting it makes a profit for the mint. They use that profit to help fund their operations.