The fact that you chose to use one form of transaction rather than another in order to minimize tax will not invalidate a transaction for income tax purposes.
However, even if the form of a transaction is valid, the IRS will look at the substance or true nature of the transaction in order to determine what the tax consequences should be.
Although the IRS says that the substance of a transaction, not its form, determines its tax consequences, a taxpayer who casts a taxable transaction in a particular form may have a difficult time changing his or her mind later, and then trying to convince the IRS that the substance of the transaction differs from its form for tax purposes. So, the general rule is that the IRS may look behind the form of a transaction in order to determine its substance for tax purposes, but taxpayers are generally locked into the form of the transaction. The thinking here is that since a taxpayer can freely choose how to set up a transaction, it's only fair to require him or her to live with its tax consequences.
Step transaction doctrine. The IRS sometimes uses what is known as the "step transaction" doctrine to argue that the substance of a particular transaction is different from its form. When it relies on this doctrine, the IRS is generally saying that it will not break up a single transaction into two or more steps for income tax purposes. So, the intermediate steps in an integrated transaction will not be assigned separate tax consequences.
Related taxpayers. The IRS pays close attention to transactions that involve taxpayers who have close business or family relationships. In some cases, the tax laws have given the IRS special powers to deal with specific areas where related taxpayers have historically used their relationships to unfairly cut their taxes.
Examples of this include the denial of interest-paid deductions to businesses that borrow money to purchase life insurance contracts benefiting their officers and employees, and the special accounting rules that apply to interest and expense payments between related parties.
You can expect that IRS agents will closely scrutinize business dealings that
you have with family members or other related parties. Often, the IRS will
combine its audit of returns for a closely held corporation with an audit of
returns of the corporation's owners or principal officers, in order to discover
any attempts to shift personal expenses to the corporation. Among the items that
IRS agents are likely to pay particular attention to are: vacation trips
disguised as business trips, purchases of household furnishings or payments for
household expenses (such as repairs and mortgage payments) charged off as
corporate expenses, and excessive salaries paid to stockholders and relatives.