DDG has done excellent work building their traffic[0] and have been getting a solid 10-12 million or so searches per day for a while. Even if you halve that due to !bang redirects and ad blocking and put a fairly low CPM on the ads they have quite a few millions or or low tens of millions coming in. I haven't been following too closely but my impression is Gabriel has been increasing staffing and other costs at a rate far lower than the increasing revenue.
Additionally the donation itself got a vast amount of coverage in the relevant communities, including HN, so the expenditure is offset against advertising for user acquisition they didn't need to do. It probably also strengthened their core community, making their users more sticky. The donation also went to some of the infrastructure they use anyway.