Should the government collect taxes on the buoyant times but then refund them during market downturns? That would be a nightmare. No government wants to be on the hook for refunds during a downturn.
AFAIK Danish tax on stock gains/losses works like this. Stock gains are heavily taxed while stock losses give you a tax rebate.
Such a gem of a movie