6 U.S. Code § 453 (b) Except as authorized by section 2601 of title 10, by section 93 of title 14, or by section 321n or 464 of this title, gifts or donations of services or property of or for the Department may not be accepted, used, or disposed of unless specifically permitted in advance in an appropriations Act and only under the conditions and for the purposes specified in such appropriations Act.The exceptions do not apply here, I checked.
The term "permitted in advance in an appropriations Act" means there has to be an appropriation to spend the funds.
If the donation goes directly to the Treasury, it is the same thing. Let's say Mexico deposited $25 billion in the Treasury. Those funds would have to be appropriated for a wall. (US Constitution, Article I, Section 9, 7). The only way around this would be a Treaty, I think, but that requires the Senate.
You do understand that Congress already voted on that in 2006?
What part of DHS SHALL build a wall from sea to sea is not clear to you?