(1) An allowed claim of a creditor secured by a lien on property in which the estate has an interest, or that is subject to setoff under section 553 of this title, is a secured claim to the extent of the value of such creditor’s interest in the estate’s interest in such property, or to the extent of the amount subject to setoff, as the case may be, and is an unsecured claim to the extent that the value of such creditor’s interest or the amount so subject to setoff is less than the amount of such allowed claim. Such value shall be determined in light of the purpose of the valuation and of the proposed disposition or use of such property, and in conjunction with any hearing on such disposition or use or on a plan affecting such creditor’s interest.
(2) If the debtor is an individual in a case under chapter 7 or 13, such value with respect to personal property securing an allowed claim shall be determined based on the replacement value of such property as of the date of the filing of the petition without deduction for costs of sale or marketing. With respect to property acquired for personal, family, or household purposes, replacement value shall mean the price a retail merchant would charge for property of that kind considering the age and condition of the property at the time value is determined.
(b) To the extent that an allowed secured claim is secured by property the value of which, after any recovery under subsection (c) of this section, is greater than the amount of such claim, there shall be allowed to the holder of such claim, interest on such claim, and any reasonable fees, costs, or charges provided for under the agreement or State statute under which such claim arose.
(c) The trustee may recover from property securing an allowed secured claim the reasonable, necessary costs and expenses of preserving, or disposing of, such property to the extent of any benefit to the holder of such claim, including the payment of all ad valorem property taxes with respect to the property.
(d) To the extent that a lien secures a claim against the debtor that is not an allowed secured claim, such lien is void, unless—
(1) such claim was disallowed only under section 502 (b)(5) or 502 (e) of this title; or
(2) such claim is not an allowed secured claim due only to the failure of any entity to file a proof of such claim under section 501 of this title.