Where the disposal of coal or iron ore is covered by section 631, no deduction shall be allowed for expenditures attributable to the making and administering of the contract under which such disposition occurs and to the preservation of the economic interest retained under such contract, except that if in any taxable year such expenditures plus the adjusted depletion basis of the coal or iron ore disposed of in such taxable year exceed the amount realized under such contract, such excess, to the extent not availed of as a reduction of gain under section 1231, shall be a loss deductible under . This section shall not apply to any taxable year during which there is no income under the contract.