I don't see how it could possibly could be illegal in any jurisdiction.
The only part of the US public domain that won't fly in many countries is the waiver of moral rights (mainly the right to attribution). Since my country does not allow this waiver, the authors might be able to sue me in my jurisdiction if I started claiming to be the author of the code, which would have been ok in the US. But the voluntary non-exclusive transfer of usage, modification and distribution rights is surely allowed in every jurisdiction, so there is no reason that that part of the dedication would not be valid.
And if there exists a jurisdiction where the transfer of material rights isn't allowed at all, selling a license also wouldn't fix anything. Unless there's a jurisdiction out there somewhere that allows the transfer only in exchange for money or in a one-on-one contract, but then open source licenses also wouldn't apply there and I feel like I would've heard about it as a fun fact somewhere on the Internet by now...
The only part of the US public domain that won't fly in many countries is the waiver of moral rights (mainly the right to attribution). Since my country does not allow this waiver, the authors might be able to sue me in my jurisdiction if I started claiming to be the author of the code, which would have been ok in the US. But the voluntary non-exclusive transfer of usage, modification and distribution rights is surely allowed in every jurisdiction, so there is no reason that that part of the dedication would not be valid.
And if there exists a jurisdiction where the transfer of material rights isn't allowed at all, selling a license also wouldn't fix anything. Unless there's a jurisdiction out there somewhere that allows the transfer only in exchange for money or in a one-on-one contract, but then open source licenses also wouldn't apply there and I feel like I would've heard about it as a fun fact somewhere on the Internet by now...