                  FOR PUBLICATION
  UNITED STATES COURT OF APPEALS
       FOR THE NINTH CIRCUIT

GEORGE J. KENNEY,                      
                Plaintiff-Appellant,
                v.                          No. 04-16748
UNITED STATES OF AMERICA,
              Defendant-Appellee,            D.C. No.
                                           CV-03-03848-BZ
               and
TICOR TITLE CO. OF CALIFORNIA,
      Defendant-counter-claimant.
                                       

GEORGE J. KENNEY,                      
                 Plaintiff-Appellee,
                v.                          No. 04-17019
UNITED STATES OF AMERICA,
             Defendant-Appellant,            D.C. No.
                                           CV-03-03848-BZ
               and
TICOR TITLE CO. OF CALIFORNIA,
      Defendant-counter-claimant.
                                       




                            9909
9910                  KENNEY v. UNITED STATES



GEORGE J. KENNEY,                           
                 Plaintiff-Appellee,
                v.
UNITED STATES OF AMERICA,                          No. 05-15354
              Defendant-Appellant,
                                                    D.C. No.
                                                  CV-03-03848-BZ
               and
TICOR TITLE CO. OF CALIFORNIA;
FIRST SELECT INC.; ESKANOS &
ADLER, PC,
                       Defendants.
                                            

GEORGE J. KENNEY,                           
                Plaintiff-Appellant,
                v.
UNITED STATES OF AMERICA,                          No. 05-15386
               Defendant-Appellee,
                                                    D.C. No.
                                                  CV-03-03848-BZ
               and
TICOR TITLE CO. OF CALIFORNIA;                      OPINION
FIRST SELECT INC.; ESKANOS &
ADLER, PC,
                        Defendants.
                                            
         Appeal from the United States District Court
             for the Northern District of California
       Bernard Zimmerman, Magistrate Judge,* Presiding




  *Pursuant to a stipulation of the parties Magistrate Judge Bernard Zim-
merman presided in this case.
                      KENNEY v. UNITED STATES                     9911
                    Argued and Submitted
           June 12, 2006—San Francisco, California

                      Filed August 17, 2006

   Before: Procter Hug, Jr. and Diarmuid F. O’Scannlain,
   Circuit Judges, and Roger T. Benitez,** District Judge.

                      Opinion by Judge Hug




  **The Honorable Roger T. Benitez, United States District Judge for the
Southern District of California, sitting by designation.
9914               KENNEY v. UNITED STATES


                         COUNSEL

Benjamin C. Sanchez, Tierney, Watson & Healy, San Fran-
cisco, California, for the appellant.

Kenneth L. Greene and Marion M. Erickson, U.S. Department
of Justice, Washington, D.C., for the appellee/cross-appellant.
                   KENNEY v. UNITED STATES                 9915
HUG, Circuit Judge:

   This case concerns U.S. Government (“Government”) tax
liens on the proceeds of the sale of a house owned by George
Kenney (“Kenney”) and his former wife, Donna. They owned
the house as joint tenants. The Government liens extend only
to Donna’s interest in the proceeds. Over the years Kenney
had made the entire payments on the notes secured by deeds
of trust on the property, both his share and Donna’s share. He
contends that pursuant to oral agreements with Donna those
payments of her share were to be applied to diminish Donna’s
interest in the house, and by the time the Government liens
attached Donna had no remaining interest in the house or the
proceeds of the sale of the house. Kenney and the Govern-
ment also disagree on how Kenney should receive equitable
subrogation for the loan payments he made; at issue is the
amount of the proceeds to which the Government is entitled
and whether Kenney should receive interest on his equitable
subrogation. There is also an issue of entitlement to litigation
costs and attorneys fees. We have jurisdiction under 28
U.S.C. § 1291.

                  I.   Factual Background

   In December 1978, Kenney and Donna purchased a house
in Fremont, California. Kenney and Donna paid $25,000
down and obtained a loan for the remaining $52,950 of the
house’s cost. Kenney and Donna were co-obligors on a prom-
issory note secured by a deed of trust on the house, and they
held title as joint tenants.

   In June 1989, Kenney and Donna permanently separated. In
August 1991, Kenney agreed to assist Donna in obtaining an
additional $59,750 loan from a different lender. The loan pro-
ceeds were paid to Donna alone, but Kenney and Donna
jointly executed a note and second deed of trust against the
house to secure the promissory note. Pursuant to oral agree-
ments between Kenney and Donna made between 1989 and
9916               KENNEY v. UNITED STATES
1991, Kenney agreed to assume responsibility for the two
loans on the house. From 1989 until the house was sold in
2002, Kenney made all of the payments on the loans. In total,
Kenney paid principal and interest of $166,826 on the two
loans, according to the parties’ joint stipulation for summary
judgment.

   Between November 1995 and April 1997, the Government
filed five tax liens against Donna relating to her business for
tax years 1991-1995. In 1996, Kenney and Donna began
divorce proceedings. On November 29, 1996, they entered
into a property settlement agreement. The agreement was
incorporated into the judgment of marriage dissolution, filed
on March 6, 1997. Under the agreement, Donna was required
to execute a quitclaim deed to the residence in favor of Ken-
ney. She executed this deed on October 9, 1999.

   Kenney subsequently decided to sell the house. To allow
this in light of the Government’s liens against Donna’s share,
the Government and Kenney entered into a substitution-of-
proceeds agreement. Under this agreement, Kenney agreed
that the liens would attach to the sale proceeds to the same
extent as to the house itself.

   On July 2, 2002, the house was sold for $395,000. The net
proceeds were $307,244, after payment of the balances due on
the notes secured by the deeds of trust and expenses of sale.
The Government asserted its liens against one-half of those
proceeds, or $153,622, which was held in escrow by Ticor
Title Company of California.

                  II.   Procedural History

   On August 19, 2003, Kenney filed a complaint against the
Government to quiet title in the sale proceeds under 28 U.S.C.
§ 2410. He named Ticor as a co-defendant, but Ticor was dis-
missed from the suit after the sale proceeds and interest
                   KENNEY v. UNITED STATES                 9917
earned on the proceeds were taken from escrow and deposited
with the clerk of the court.

  On June 30, 2004, Kenney and the Government filed cross
motions for summary judgment. Kenney contended in his
motion for summary judgment that, as a result of his pay-
ments on the notes secured by the deeds of trust and the oral
agreements with Donna, Donna’s interest in the house and
proceeds had diminished to zero. As an alternate theory, Ken-
ney contended that he was entitled to equitable subrogation
against Donna’s interest for the payments he had made on
Donna’s share of the notes secured by the deeds of trust. Ken-
ney also contended that he was entitled to interest on the pay-
ments he made on behalf of Donna.

   In reply, the Government denied Kenney’s entitlement to
recovery under his “diminishing interest” theory, but agreed
that he was entitled to equitable subrogation, although this
theory had neither been mentioned in the complaint nor had
facts consistent with this theory been alleged in the complaint.
The Government denied that he was entitled to interest on the
payments he paid for Donna’s share. The Government also
arrived at a different calculation of the manner in which the
equitable subrogation was to be applied and sought summary
judgment for a different amount.

   In a published order on July 30, 2004, the district court
granted summary judgment in part to the Government and
denied summary judgment to Kenney. Kenney v. United
States, 329 F. Supp. 2d 1193 (N.D. Cal. 2004). The order
rejected Kenney’s diminishing interest theory, but calculated
an equitable subrogation award for Kenney that did not
include interest on his payments as Kenney requested. Id. at
1998. The court rejected the Government’s calculation of the
equitable subrogation and adopted in substance Kenney’s cal-
culation. Final judgment was entered August 11, 2004.

  On August 24, 2004, Kenney filed a motion for an award
of litigation costs under 26 U.S.C. § 7430, which the district
9918               KENNEY v. UNITED STATES
court granted to the extent that the costs were attributable to
the equitable subrogation theory. The district court made this
order an amendment nunc pro tunc to the final judgment. The
district court also ordered the parties to present specific evi-
dence of litigation costs, and on February 22, 2005 the district
court granted Kenney $5,814.38 in litigation costs ($5,664.38
in attorney fees and $150 in costs).

   The Government and Kenney filed timely notices of appeal
from both the August 2004 final judgment and February 2005
order.

                        III.   Analysis

1.   Kenney’s Diminishing Interest Theory

  We review de novo a district court’s partial grant of sum-
mary judgment in favor of the United States. United States v.
$100,348 in U.S. Currency, 354 F.3d 1110, 1116 (9th Cir.
2004).

   [1] Kenney’s opening brief argues that as a result of the
oral agreements to assume Donna’s loan obligations, Donna
impliedly agreed to proportionately transfer to Kenney her
equity interest in the house. Therefore, Kenney would have
gained all of Donna’s interest before the tax liens attached.
However, in his reply/answering brief, Kenney concedes that
this argument has been foreclosed by In re Marriage of Ben-
son, 116 P.3d 1152 (Cal. 2005), which held that such agree-
ments are required to be in writing. Kenney then raises the
new argument that the precedent established by Benson sug-
gests that remand is necessary to “address the question of
what additional rights against the property, if any, Kenney
may have that are superior to the tax liens.” But Benson estab-
lished no new rights, and Kenney already had a full opportu-
nity to present legal and equitable theories to the district
court.
                       KENNEY v. UNITED STATES                         9919
2.       Calculating Kenney’s equitable subrogation award

   [2] The parties do not dispute that Kenney is entitled to
equitable subrogation for some of the house sale proceeds. To
whatever extent Kenney is subrogated to the rights of the
lenders, he has priority over the Government in the disputed
proceeds, since the lenders’ interests are senior to the later-
filed Government liens.1 The method of calculating Kenney’s
equitable subrogation award is a question of law. We review
de novo the district court’s conclusions of law. Tritchler v.
County of Lake, 358 F.3d 1150, 1154 (9th Cir. 2004).

   Under the district court’s method, the $307,244 net pro-
ceeds were divided into equal shares of $153,622 for Kenney
and Donna, whereupon equitable subrogation was applied to
credit Kenney $83,413 from Donna’s $153,622 share. The
$83,413 represents half of the $166,826 in mortgage pay-
ments that Kenney made between 1989 and 2002 on the two
notes.2 After deducting the $83,413 award from Donna’s
share of $153,622, there remained $70,209 in Donna’s share
available to satisfy the Government liens.

  On appeal, the Government argues that Kenney’s $83,413
should be taken from the total net proceeds of $307,244, leav-
ing a balance of $223,831 to divide between Kenney and
Donna, of which $111,915.50 (Donna’s half) would be avail-
able to satisfy the Government liens. The Government’s
approach would increase its portion by $41,706.50. The Gov-
     1
     Under 26 U.S.C. § 6323(i)(2), state law subrogation rights are recog-
nized in determining tax lien priority rights. See Fidelity Nat’l Title Ins.
Co. v. United States, 907 F.2d 868, 870 (9th Cir. 1990). California law
recognizes equitable subrogation. See, e.g., Caito v. United California
Bank, 576 P.2d 466, 471 (Cal. 1978).
   2
     We use the subrogation calculation from the district court’s final judg-
ment, not the summary judgment order. In an earlier calculation for the
summary judgment order, the district court used the figure of $167,269 as
the amount of the payments on the notes rather than the $166,826 to which
both parties now agree.
9920                   KENNEY v. UNITED STATES
ernment argues that because equitable subrogation only
allows Kenney to “stand in the shoes” of the lenders, he
should be paid from the net proceeds as a lender, before his
and Donna’s shares are divided.3

   As the district court noted, the Government’s method
would force Kenney to take his subrogation award from pro-
ceeds in which he has a half interest, effectively forcing him
to pay for half of the amount to which he is entitled. See Ken-
ney, 329 F. Supp. 2d at 1198. The Government relies on Caito
v. United California Bank, 576 P.2d 466 (Cal. 1978) in con-
tending that only the $83,413 paid on Donna’s account should
be deducted as equitable subrogation from the entire proceeds
of the sale before the division between Donna and Kenney.
The Caito case does not support the Government’s position.
In that case the Caitos and the Caponis were cotenants of a
farm and secured a loan from Bank of America (“B of A”)
secured by a deed of trust on which the parties were equally
liable. The Caponis executed another note to United Califor-
nia Bank (“UCB”) that was secured by a deed of trust on the
Caponis’ one-half interest in the farm. The Caitos operated
the farm and made payments of $17,500 to B of A from the
proceeds of the farm operation. Ultimately B of A foreclosed
and at issue was the amount of proceeds from the sale of the
farm in excess of B of A’s lien that UCB, as the Caponis’ lien
holder, was to receive. The California Supreme Court held
that in applying equitable subrogation the Caitos would be
entitled to the amount they paid for the Caponis’ share of the
obligation. The court stated, “UCB could not expect to benefit
from an improved security position resulting from the
Caponis’ debt paid by the Caitos. The Caitos would then have
paid a debt ‘for which another is primarily liable, and which
  3
    By undertaking to pay a debtor’s obligation to a creditor, the subrogee
is equitably subrogated to the position of the creditor and succeeds to the
creditor’s rights against the debtor; “[t]he right of subrogation is purely
derivative.” Reliance Nat’l Indem. Co. v. General Star Indem. Co., 85 Cal.
Rptr. 2d 627, 635 (Cal. Ct. App. 1999).
                       KENNEY v. UNITED STATES                        9921
in equity and good conscience should have been discharged
by the latter.’ ” Caito, 576 P.2d at 472 (citations omitted).4
The method of calculation proposed by the Government
would allow the Government to benefit from an improved
security position resulting from Donna’s debt paid by Ken-
ney.

  [3] Several other California cases establish that Kenney
should be credited from the total net proceeds for the
$166,826 in principal and interest payments that he made.
Southern Adjustment Bureau, Inc. v. Nelson, 41 Cal. Rptr.
148, 149 (Ct. App. 1964), held that

      [w]hen a cotenant makes advances from his own
      pocket to preserve the common estate, his invest-
      ment in the property increases by the entire amount
      advanced. Upon sale of the estate he is entitled to be
      reimbursed his entire advancement before the bal-
      ance is equally divided.

(emphasis added).5 In Vides v. Vides, 30 Cal. Rptr. 447 (Ct.
App. 1963), a wife paid the mortgage installments on a house
after her husband refused to pay. Upon the sale of the house,
the court held that “the wife’s use of her separate funds to dis-
charge this obligation of the community gives her a right at
least akin to subrogation.” Id. at 448. The court held that the
wife should first be reimbursed from the net proceeds for the
  4
     Ultimately the supreme court held that the $17,500 proceeds of the
farm belonged to both the Caitos and the Caponis and was not an amount
paid solely by the Caitos, and thus, the Caitos were not entitled to equita-
ble subrogation. Caito, 576 P.2d at 473. The court also did not credit the
Caitos under equitable subrogation an amount of $6,000 that had been
loaned directly to the Caponis. Id.
   5
     See also Milian v. De Leon, 226 Cal. Rptr. 831, 836 (Ct. App. 1986)
(A cotenant who pays trust deed payments against the property “is entitled
to contribution from the cotenant, and on partition by sale is entitled to
reimbursement for those expenditures before division of the proceeds
among the property owners.”).
9922                KENNEY v. UNITED STATES
installment sums she had paid, with the remaining proceeds
then divided equally between the spouses. Id.

   [4] It is apparent that there are two methods of calculation
that arrive at the same result. Under one method of calcula-
tion, Kenney’s payments of $166,826 are deducted from the
net proceeds of $307,244 for a balance of $140,418. Donna’s
half of those proceeds would be $70,209, to which the Gov-
ernment is entitled. The other method is the one used by the
district court in the instant case. The total net proceeds of
$307,244 are divided, leaving Donna with her share of
$153,622. From that is deducted one-half the payments made
by Kenney ($83,413). This deduction leaves an identical final
balance of $70,209 to which the Government is entitled. It is
obvious that the full $166,826 Kenney paid should not be
deducted from Donna’s share because one-half of that amount
is applicable to his share. It is equally obvious that it is ineq-
uitable to deduct only half of the payments, $83,413, from the
total net proceeds before dividing them, as the Government
contends, because this would leave Kenney recovering only
one-half of the payments he made for Donna. Equitable sub-
rogation “is not a fixed and inflexible rule” and its develop-
ment is “the natural consequence of a call for the application
of justice and equity to particular situations.” In re Johnson’s
Estate, 50 Cal. Rptr. 147, 149 (Ct. App. 1966) (internal quota-
tion omitted).

   [5] The district court reached the correct result in its calcu-
lation, holding that Kenney is entitled to $83,413 out of the
$153,622 held in escrow; however, we must adjust its final
conclusion, because the court incorrectly gave the Govern-
ment all of the $2,735 escrow interest on the $153,622. Ken-
ney’s award of $83,413 is 54% of the $153,622 in
controversy, so he should properly receive 54% ($1,477) of
the $2,735 escrow interest on the $153,622. His net award,
therefore, should be $84,890 of the $156,357 in proceeds
deposited with the clerk of the court. The Government should
receive $1,258 in escrow interest in addition to its $70,209,
                   KENNEY v. UNITED STATES                 9923
leaving it with $71,467 of the $156,357. Any additional inter-
est earned after the disputed proceeds were deposited with the
clerk should be distributed 54% to Kenney and 46% to the
Government.

3. Denial of interest on Kenney’s equitable subrogation
award

   The district court enjoys broad powers in equity, and “its
choice of equitable remedies is reviewed for an abuse of dis-
cretion.” Labor/Cmty. Strategy Ctr. v. Los Angeles County
Metro. Transit Auth., 263 F.3d 1041, 1048 (9th Cir. 2001).
“The district court abuses its discretion when its equitable
decision is based on an error of law or a clearly erroneous fac-
tual finding.” United States v. State of Washington, 157 F.3d
630, 642 (9th Cir. 1998).

   Kenney argues that the district court erred in denying him
interest on the payments he made for Donna. The district
court stated that it denied interest because Kenney “has
received a return on his investment through the appreciation
in the value of the Property.” Kenney, 329 F. Supp. 2d at
1198. Kenney cites Caito v. United California Bank, 576 P.2d
466 (Cal. 1978), to argue that the district court erred in deny-
ing interest by taking into account Kenney’s gain from the
substantial appreciation in his interest in the house. This case
is not applicable. Caito did not concern whether interest
should be considered in an equitable subrogation award.

   [6] Under its broad powers in equity, the district court did
not abuse its discretion in denying interest. The district court
was free to consider that Kenney’s payments on behalf of
Donna enabled him to protect his own half interest in the
property — and that the property appreciated during the rele-
vant time period. It appreciated in value from $246,000 in
1989 when Donna and Kenney separated to $395,000 when
it was sold in 2002. We therefore affirm the district court’s
denial of interest on Kenney’s equitable subrogation award.
9924               KENNEY v. UNITED STATES
4.   The award of litigation costs to Kenney

   [7] Section 7430(a) of Title 26 of the United States Code
provides that a “prevailing party” in federal tax administrative
or court proceedings may be awarded reasonable administra-
tive and litigation costs. Kenney received an award of his liti-
gation costs under section 7430(a), but did not request or
receive an award for his administrative costs. The parties
agree that Kenney was the prevailing party under section
7430(c)(4)(A), but dispute whether the Government estab-
lished that its litigation position was “substantially justified”
under section 7430(c)(4)(B). If the Government’s position
was substantially justified, Kenney is not treated as the pre-
vailing party. Id. “Substantially justified” means “justified to
a degree that could satisfy a reasonable person,” or having
“reasonable basis both in law and fact.” Pierce v. Underwood,
487 U.S. 552, 565 (1988). To be substantially justified means
more than “merely undeserving of sanctions for frivolous-
ness.” Id. at 566.

   The district court’s determination of whether the position of
the United States was substantially justified is reviewed for
abuse of discretion. Pierce, 487 U.S. at 559; Huffman v.
C.I.R., 978 F.2d 1139, 1143 (9th Cir. 1992). The district court
abuses its discretion if it bases its decision on an erroneous
legal conclusion or a clearly erroneous finding of fact. United
States v. Marolf, 277 F.3d 1156, 1160 (9th Cir. 2001).

   [8] We have held that the reasonableness of the Govern-
ment’s position is analyzed separately for the administrative
and the judicial proceedings. “[T]he position taken in the
administrative proceeding does not automatically apply to the
judicial proceeding . . . [A] bifurcated analysis of ‘substan-
tially justified’ should be made in each proceeding.” Huffman,
978 F.2d at 1146. The district court abused its discretion in
analyzing the Government’s position in the litigation proceed-
ings by including its position in the administrative proceed-
ings. Kenney made no claim for costs and fees from the
                   KENNEY v. UNITED STATES                  9925
administrative proceeding. Huffman requires a bifurcated
analysis of the Government’s position in the administrative
proceedings separate from its position in the court proceed-
ings.

   In analyzing the legislative intent behind section 7430,
Huffman noted that if the Government’s position in an admin-
istrative proceeding is not applicable, the Government’s posi-
tion is that taken in the litigation. Id. at 1146. Because Kenney
requested only litigation costs, we only examine the Govern-
ment’s litigation position. The district court referenced a 2002
Kenney letter to IRS administrators in the administrative pro-
ceeding that asserted a right of subrogation, and the court
wrongly faulted the Government for not responding to the
assertion until the summary judgment stage of litigation. This
mixes the analysis of administrative and judicial proceedings
in a manner that contradicts Huffman.

   Under the proper analysis, it is difficult to find the Govern-
ment’s litigation position unreasonable. It is important that
Kenney did not allege facts consistent with an equitable sub-
rogation argument in his complaint filed in the district court.
In fact, the key allegation that Kenney advanced in his com-
plaint under the heading “Plaintiff’s Acquisition of Interest”
— that Donna’s interest in the home was zero when the Gov-
ernment’s November 1995 and June 1996 notices of tax liens
were filed — is inconsistent with equitable subrogation but
fully consistent with Kenney’s diminishing interest claim.

   [9] In its answer to Kenney’s complaint, the Government
denied Kenney’s diminishing interest allegation. “Generally,
the position of the United States in the judicial proceeding is
established initially by the Government’s answer to the [com-
plaint].” Huffman, 978 F.2d at 1148. The Government’s
answer to Kenney’s complaint was entirely defensible.
Indeed, the district court granted summary judgment to the
Government on the diminishing interest theory, a grant that
we affirm in this opinion. For purposes of avoiding section
9926               KENNEY v. UNITED STATES
7430 costs, it cannot be the Government’s duty to address fac-
tual allegations not raised in a complaint. Had Kenney made
factual allegations that would have put the Government on
notice of an equitable subrogation theory, and had the Gov-
ernment denied them, the Government’s litigation position as
taken here might not have been substantially justified. See
Hanson v. C.I.R., 975 F.2d 1150, 1156 (5th Cir. 1993) (reject-
ing an approach wherein the Government could “pursue a
substantively unreasonable theory in litigation, settle the case
on the eve of summary judgment, and escape an award of liti-
gation costs to the prevailing tax litigant”).

   [10] Only in his motion for summary judgment, ten months
after he filed his complaint, did Kenney assert equitable sub-
rogation before the district court. In response to the motion,
the Government conceded that equitable subrogation applied
but disputed the amount that was available to Kenney. The
Government’s response was reasonable under these circum-
stances. See Huffman, 978 F.2d at 1148 (“Case law holds that
if the Government concedes the petitioner’s case in its
answer, its conduct is reasonable.”).

   [11] We therefore reverse the district court’s order granting
Kenney’s motion for litigation costs, and the district court’s
award to Kenney of $5,814.38 in litigation costs. The district
court abused its discretion in finding the Government’s litiga-
tion position not substantially justified.

                      IV.   Conclusion

   For the reasons expressed above, we AFFIRM the district
court’s summary judgment grant in favor of the Government
on Kenney’s diminishing interest theory. We AFFIRM the
district court’s calculation of Kenney’s equitable subrogation,
but adjust the amount to reflect the appropriate amount of
interest on the funds held in escrow. We AFFIRM the district
court’s denial of interest on Kenney’s equitable subrogation
                  KENNEY v. UNITED STATES            9927
award. We REVERSE the district court’s award of litigation
costs to Kenney.

  Each party shall bear its own costs on appeal.

  AFFIRMED IN PART. REVERSED IN PART.
