If you understand four sections of the Internal Revenue Code, you understand the structural logic of every tax-aware portfolio decision. Most TLH explainers gesture at "wash sale rules" and stop there. The actual code is more interesting and more useful — it's a small collection of rules that, taken together, define the entire surface that direct-indexing strategies operate on.
This is the field guide. Save it.
§1091 — The wash-sale rule
What it does: disallows a loss on the sale of stock or securities if the seller buys "substantially identical" stock or securities within 30 days before or after the sale. The disallowed loss is added to the basis of the replacement.
Window: 30 days before, day of sale, 30 days after = 61 calendar days total.
Why it exists: Congress enacted §1091 in 1921 specifically to stop investors from generating fake tax losses by selling at a loss and immediately rebuying — a practice that was rampant when the income tax was new and capital-gains netting existed.
What "substantially identical" means in practice: the IRS has never published a bright-line definition. The accepted interpretation:
- Same ticker symbol → identical, always.
- Two ETFs tracking the same index from different sponsors (SPY, IVV, VOO) → almost certainly identical.
- Two ETFs tracking different but overlapping indexes (SPY vs VTI; S&P 500 vs Total Market) → typically not identical.
- A stock and an option on the same stock → IRS treats them as identical for wash-sale purposes.
- Two stocks in the same sector (XOM, CVX) → not identical.
Edge cases worth knowing: dividend reinvestments (DRIPs) trigger the rule. Spousal accounts trigger it (the rule applies to the taxpayer, not the account). IRA buys can trigger losses in your taxable account.
See the full wash-sale explainer for traps and workflow.
§1014 — Step-up basis at death
What it does: when an heir inherits a security through an estate, the heir's cost basis is the fair market value at the date of death, not the decedent's original cost. All of the deferred gain accumulated over the decedent's lifetime is forgiven.
Why it exists: §1014 has been law in some form since 1921. The economic rationale is debated — some argue it prevents double taxation (estate tax and capital gains on the same appreciation); others see it as an explicit policy choice to favor inherited capital. Either way, it's the legal foundation of most high-net-worth tax planning.
What this means for TLH: the deferral your harvested losses create isn't temporary. If you hold the basis- reduced replacement security through death, the embedded gain it carried is forgiven. TLH plus buy-and-hold plus eventual step-up is the closest thing in U.S. tax law to a tax-free return.
See the full step-up explainer for worked examples.
§1233 — Short sales: always short-term
What it does: any gain or loss on closing a short position is short-term, regardless of how long the short was open. Long-term capital gains rates do not apply to closed short sales.
Why it exists: short positions don't have a standard "holding period" the way long positions do (the holding period for a long position runs from purchase date; for a short, the position is borrowed, sold, and then closed — there's no acquisition date in the same sense). §1233 imposes a uniform short-term character.
What this means for TLH on a short overlay: any short-position gain is taxed at your ordinary-income rate (up to 37% federal), not the long-term capital-gains rate (20% top federal). Conversely, short-position losses are short-term losses, which match against short-term gains first — useful if you have any.
The practical implication: a short overlay generates a different flavor of tax-alpha than a long-only direct-index sleeve, and short-side harvesting is more about generating short-term losses (which are the most valuable to harvest, since they offset the most expensive gains) than about timing.
§1259 — Constructive sale of appreciated financial positions
What it does: if you "constructively" sell an appreciated position by entering into an offsetting transaction (e.g., shorting the same security you hold long, or entering an offsetting forward contract), the IRS treats it as if you sold the position and recognized the gain.
Why it exists: before §1259 was enacted in 1997, sophisticated investors used "short against the box" — shorting an identical position against a long they wanted to keep — to lock in gains without realizing them for tax purposes. §1259 closed this loophole.
What this means for short overlays: you cannot short a position you already hold long. The constructive-sale rule forces immediate recognition of the embedded gain. Direct-indexing software has to track this — if you hold AAPL long in your direct sleeve, you cannot short AAPL in the overlay sleeve, even if it would generate a useful harvest opportunity. HarvestEngine's risk gates explicitly check for this collision.
The full picture, in one diagram
| Section | What it constrains | What it enables |
|---|---|---|
| §1091 | Naive harvest-and-rebuy | Deliberate harvest-and-replace via similar-but-not-identical positions |
| §1014 | (nothing — it's a benefit) | Permanent deferral of accumulated unrealized gain through death |
| §1233 | Long-term tax treatment of short positions | Predictable short-term character on every short close |
| §1259 | Shorting positions you already hold long (constructive sale) | Pure short overlay across non-overlapping symbols |
Other sections worth knowing
Beyond the core four, these come up in TLH adjacent contexts:
- §1212 — capital loss carryovers. Net capital losses carry forward indefinitely (and retain short/long-term character).
- §1222 — definition of short-term vs long-term (one-year holding period for long-term).
- §1031 — like-kind exchanges. Used to apply to securities; the 2017 Tax Cuts and Jobs Act limited it to real estate. Mentioned only because older articles still reference it.
- §408A / §401(k) — retirement accounts. The whole TLH framework only applies in taxable accounts. Realizing losses inside a tax-deferred wrapper does nothing (everything inside is post-tax-treatment).
- §170 — charitable contributions. Donating appreciated stock to charity captures fair market value as a deduction without triggering the gain. A complement to TLH for high-net-worth charitable givers.
Why this matters for software
Tax-aware portfolio software is fundamentally a §-checking machine. Every proposed trade has to clear:
- §1091 — is there a wash-sale risk on either leg?
- §1233 — what's the realized character (short-term vs long)?
- §1259 — does this short collide with a long position the user holds?
HarvestEngine's risk engine names each of these gates explicitly in the proposal warnings — so when a trade is blocked, you can see exactly which section of the code is the reason. We tried hiding the section numbers behind plain-English warnings; it turned out users prefer the legal cite. It's auditable, it's googleable, and it's right.