The aid was going first to fighters, then to stockpiles, then to the people. To the extent it could be traded for weapons it was. Now we’re seeing allegations UNRWA employees participated in the October 7th attacks [1].
[1] https://www.nytimes.com/2024/01/26/world/middleeast/un-aid-i...
If the humanitarian aid organisations themselves are Hamas, then you could just arrest them.