I see a lot of articles describing how many corporations (notably Amazon) pay minimal/zero tax. What prevents me from having my employer pay my salary to a corporation I set up and having the corp use these same tax loopholes while buying everything I need? What loopholes would I be able to effectively leverage in this situation?
You are certainly free to start a corporation and to try to get your current employer (or some other company) to hire the company as a contractor (you can't have a corporation as an employee). There are specific tests that the IRS requires to determine whether companies are employing independent contractors legitimately that you'd need to pass. That will, among other things, fundamentally change your relationship with your current employer. In order to demonstrate that you are a legitimate independent contractor and not just a misclassified employee, there is a very strong chance that you'd need to do things like maintain relationships with multiple companies, among other things indicative of an actual independent business. Additionally, you wouldn't get a paycheck every couple weeks, you'd need to invoice the company you did work for, wait for them to pay the invoice, chase them down when they forgot to pay, etc. And if the employer gets into trouble and declares bankruptcy, you'll likely have some of the money it previously paid you clawed back in order to distribute it to higher-priority creditors.
Assuming you've managed to start a legitimate independent contracting business, the next issue is the extra things that you need to pay for. Most employees get at least an employer subsidy for health insurance. Most get a few holidays, vacation time, and sick time. Quite a few get access to a retirement plan (401(k), SIMPLE IRA, etc.) often with an employer match. Those are out now that you're a contractor. Your company will need to adjust the rates it charges the company you're contracting for in order to cover those expenses. Plus, you'll need to account for the time you're not able to bill because you're between contracts.
OK. So lets assume that you've started a legitimate independent contracting business and you've negotiated a higher rate with companies so that you're comparing apples to apples in terms of compensation. The corporation can't simply buy "everything you need" and deduct that as an expense. The corporation can buy a house, for example, but if it lets you live there, the rent it could have charged you is taxable salary to you. The corporation can buy a car but if it lets you use the car for personal errands, the portion of the cost of the car that is for personal use is taxable salary to you. And you'll need enough of a salary to be able to pay those taxes, to buy food, to pay for a vacation if you want to take one, etc.
There are some things that you'll be able to deduct as a corporation that you can't as an employee-- if you need a computer, you can probably deduct that even if you happen to occasionally play games on it. But you're in trouble if you use a Mac for all your work-related tasks and try to deduct a Windows PC that you use exclusively for gaming. You may be able to get a home office deduction for part of your house if you use it exclusively for business.
But while you may find a few more deductions, as a self-employed person, you'll also have to pay self-employment tax. You'll be responsible for both the employer and the employee's portion of Social Security and Medicaid which is 15.3% of your income in addition to income taxes. You may find that you could plausibly deduct enough expenses to balance out that additional tax burden but it's unlikely. For most people, moving to self-employment is going to increase your tax burden.
Having set the baseline, we can move on to tax loopholes. Realistically, you aren't going to be able to take advantage of the same loopholes that giant corporations do. Those loopholes require expensive lawyers and tax accountants to structure correctly and they require businesses that are at a certain level of complexity to ensure that the necessary transactions have an actual business purpose (that happens to result in lower taxes) rather than being a pure tax dodge (which the IRS can simply unwind). If you have a simple business, it is very easy for the IRS to specify how you need to account for things. If you have a very complicated business, there are lots of different ways that different companies have to be allowed to account for things and, thus, opportunities for companies to choose a method that minimizes taxes.
For example, if you're Coca Cola, it makes good business sense to set up subsidiary corporations in every country you do business in so that Coke USA is insulated from liability issues incurred by Coke Poland (and vice versa). Each subsidiary business will need to license the Coke intellectual property (logos, recipes, etc.). That will be a legitimate business expense for those subsidiaries and income for whichever corporation owns that intellectual property. If Coca Cola creates a subsidiary business that just holds the intellectual property and locates that company in a country that has very low taxes on income derived from intellectual property licensing, it can effectively move a lot of high-tax income from each of its country-specific subsidiaries into a lot of low-tax income to its intellectual property subsidiary and thus reduce its overall tax burden. But this is a relatively costly exercise-- lawyers and accountants to set up the subsidiaries, draft the licensing agreements, determine and justify what a reasonable payment would be, etc. You can't just draw a "mdh60834eoopy Corp" logo in Paint, create a separate corporation to own it in a low-tax jurisdiction, and zero out the "mdh60834eoopy Corp" income in the US. You need to have enough taxable revenue and a sufficiently complicated business structure to be able to pay for the professionals you need to structure things and to have the business justification for the underlying transactions.
Realistically, the deductions that large corporations are entitled to are not things that your average single-person independent contractor could plausibly take advantage of. Even if you could legally do so, the cost of setting up the necessary structures, transactions, contracts, etc. would vastly exceed the tax savings you might realize.
Note, also, that what Amazon is doing to avoid paying taxes isn't going to work for you.
When a company acquires another company they do so with pre-tax dollars. Amazon uses it's profits to buy up companies (notice how many it keeps eating!), this converts income into share price, they don't pay taxes, their investors only pay capital gains rates and only when they sell.
You, however, are working to live on, not to raise the share price of your company.