It's not as hard as you think. They wouldn't actually pay for it. Just pay for it by proxy. The US gives Mexico a lot of money every year. "According to ForeignAssistance.gov, Mexico received $265 million in foreign aid in 2013."
They speculate the wall will cost no more than $8 billion to build. There's a 2,000 mile border between US & Mexico, but theoretically, a wall would only need to account for 1/2 of that due to natural barriers. While it's not as easy as removing all funding, realistically, holding back 10% of the foreign aid we give them, 300 years and it'll pay itself off.
Also keep in mind that it would take between 10-15 years to build a wall of that caliber. It's not easy, but it's feasible. We live on borrowed credit, anyway.