This is indeed a very unwise, unsound law. Legalizing drugs would have a dramatic impact on the murder, mayhem, and corruption plaguing the Mexican border zone, and we'd waste a hell of a lot less money punishing consenting adults for things that they do to themselves.
Even if we did legalize drugs, I'm pretty sure that Mexico will be a fucked-to-death political and economic basket case that people are willing to risk their lives to escape from, so I don't see it having a major impact on the numbers of people that want to cross the border.
I'd put more stock on ending agricultural subsidies and wage-loopholes for farmers and shifting the production of non-machine harvestable crops to where the labor force is. Seems like that'd work better than creating incentives for US farmers to import a labor force that they can pay below market wages to.
Legalize pot and we're gonna need all the farmworkers we can get our hands on, Bucko.