Bonds trade with accrued interest attached. A bond pays its coupon to whoever owns it on the payment date, so a buyer who takes a bond two months into a six-month coupon period will receive the full six months of interest at the next payment date even though they earned only four. The market fixes this at settlement: the buyer pays the seller the interest accrued from the last coupon date up to, but not including, the settlement date, as the MSRB's definition describes, and the MSRB notes that "Accrued interest is paid to the seller by the purchaser." The quoted price of a bond, sometimes called the clean price, excludes this interest. The total the buyer actually pays, sometimes called the dirty price or full price, is the clean price plus accrued interest. Neither term is regulatory vocabulary, but both appear on trade confirmations and in market commentary, and a buyer comparing a quoted price with a settlement amount will meet the difference immediately.
The starting point for a new issue is the dated date. The MSRB defines the dated date as "The date from which interest on a new issue of municipal securities typically starts to accrue." A bond that settles after its dated date already carries accrued interest on the first day it is owned, which is why a new-issue buyer can be charged accrued interest before any coupon has been paid.
The day count is a convention, and it is not the same everywhere. The MSRB's definition continues: "Accrued interest is usually calculated on the basis of a 360-day year (assuming that each month has 30 days), but alternative day counting methods (most commonly based on a 365- or 366-day year counting actual days elapsed) are used for many securities that bear interest at a variable rate and for certain other types of securities (e.g., some municipal notes)." Its formula for the 30/360 convention is the interest rate multiplied by the par value multiplied by the number of days over 360. The convention matters only at the margin, but it explains why two people computing accrued interest on the same bond can arrive at slightly different figures.
The tax follows the economics: the seller earned it, so the seller is taxed on it. Publication 550 states the rule for both parties. For the seller: "If you sell a bond between interest payment dates, part of the price represents interest accrued to the date of sale. You must report that part of the sales price as interest income for the year of sale." For the buyer, the coupon that later arrives includes money that was really a return of the accrued interest paid at purchase, and the IRS provides one reporting mechanic for it. Under the heading "Accrued interest on bonds," Publication 550 instructs: "If you received a Form 1099-INT that reflects accrued interest on a bond you bought between interest payment dates, include the full amount shown as interest on the Form 1099-INT on Schedule B (Form 1040), Part I, line 1. Then, below a subtotal of all interest income listed, enter "Accrued Interest" and the amount of accrued interest you paid to the seller. That amount is taxable to the seller, not you. Subtract that amount from the interest income subtotal." The Schedule B page lists that subtraction among the adjustments the form allows; this is the event that produces it. The same publication notes, in its discussion of bonds bought between interest dates, that the effect is to treat the recovered accrued interest as a return of the buyer's capital, so the buyer's reported interest and the buyer's economic interest end up equal.
On a loan, accrual runs daily and payments clear it first. A simple-interest loan accrues interest each day on the outstanding principal, and each payment is applied to the interest that has accrued since the last payment before any of it reduces principal. The simple interest and loan principal pages carry the arithmetic. Two consequences follow. A payment made late carries more accrued interest and therefore retires less principal. And when payments are suspended, as during a student loan deferment or forbearance, the interest does not stop; it accrues, and if it is still unpaid when payments resume it may be added to the principal balance, after which interest is charged on the larger figure. That addition is capitalization, and the student loan interest capitalization page covers when it happens.
On a deposit, accrued is not the same as credited. A savings account may accrue interest daily and credit it to the balance monthly. Until the credit date the accrued interest is owed to the depositor but not yet in the account, and the compounding frequency page explains the disclosure that governs what happens to it if the account is closed first.