A 401K is a private retirement plan. The purpose of the employer match is to encourage you to save for retirement so you can have a better life than you'll get on the government plan alone.
The concept is you invest the 401K in the stock market where it grows at 7-10% over long term averages. Since you will have the money in until retirement in 20-50 years, random 3-5 year downturns in the market don't matter. This is a gold standard strategy, universities also invest their endowments this way.
The growth of this money is positively insane. The $10,000 you invest now will become $150,000 to $400,000 in 40 years, depending on how well the market does. If you invest the max ($15,500+employer match $6000?) and do it every year for 10 years, you'll have $3-10 million* from $155,000 of initial investment today. You can't beat this.
Even better, your 401K is immune to lawsuit, bankruptcy, tax lein, you name it, until your retirement. "Can't touch this!"
Ever hear the fable of the goose that laid the golden egg?
As for the "30%", not quite. Actually, what's going on is that 401k's are tax-deferred. You don't pay income tax on the money when you contribute it (during your working life when your salary is high and you are in a high percentage tax "bracket", i.e. Federal tax is 25-33% and state tax is 0-12%). However when you withdraw it, you pay income tax on the money then. If you are retired you may be paying Federal taxes in the 10-15% range and state taxes in the 0-4% range.
If you withdraw it when you are still working, you are still in a high tax bracket due to your higher earnings, and then, the big lump sum tends to push you into an even higher tax bracket of 28-35%/0-12% rate. And then you also pay a 10% excise tax for early withdrawal which is designed to discourage you from destroying your retirement.
So if you are saying this will put you ahead by 10%, which I think is optimistic, you really need to run the numbers actually*.
If you are a person who has no future, you have no need for retirement and can cash it out whenever you want, just lump the high tax rate and the 10%.
If you are a person with a future, you should keep your retirement -- look at which tax treaties* the USA has with your country. Then consider either moving it to your country's version of a 401K, or leaving the 401K right in the United States. I'm told we have a relatively stable financial system.
* A tax lawyer or real financial advisor can help. Most "financial advisors" are in fact salespeople, who recommend you into terrible financial products designed to get them a high sales commission. You want a fee-only advisor, whose only earnings come from charging you by-the-hour, and collect no commissions, help you develop a plan, don't want your money, and don't even need the passwords to your financial accounts.