BobKamman
Level 15

See "bargain sales" in Pub 544, among other sources.

Bargain sales to charity. 

A bargain sale of property to a charitable organization is partly a sale or exchange and partly a charitable contribution. If a charitable deduction for the contribution is allowable, you must allocate your adjusted basis in the property between the part sold and the part contributed based on the fair market value of each