economy grow 5.7% in real terms in 2021, marking the best annual growth in nearly 40 years.
Meanwhile, the labor market has seen a rapid recovery as employers added 6.4 million jobs last year and the unemployment rate fell to 3.9%.
Stimulus measures fueled this rapid recovery, which has also spurred inflation to generational highs as seen in December when the consumer price index reached 7% year over year.
Front-end rate markets are pricing roughly 25 basis point rate hikes this year beginning in March, up from just two -- one quarter ago.
The Fed has also begun to discuss shrinking its balance sheet, and we expect the Fed will let assets run off at a pace faster than the prior taper of $50 billion per month.
In anticipation of wider spreads, we managed the portfolio to decrease leverage and optimize our asset allocation with total assets decreasing by approximately $5 billion to $89 billion in the quarter.
As a result, economic leverage declined slightly from 5.8 times to 5.7 times.
Now, we were certainly not immune to the spread volatility as we experienced an economic return of negative 2.4% however, we generated earnings available for distribution of $0.28, unchanged from the prior quarter and exceeding our dividend by $0.06 per share.
With respect to capital allocation, in line with recent quarters, we increased the allocation to our credit businesses by approximately 200 basis points to 32% in the fourth quarter as prospective returns continued to favor credit.
Looking back on the full year, our credit allocation increased approximately 10 percentage points from December 2020, even with the successful sale of our commercial real estate business, which underscores the favorable fundamentals and strong execution from our resi credit and middle market lending businesses.
First, our MSR business had a solid year with assets increasing over $500 million throughout 2021 to $645 million.
And with over $200 million of MSR commitments already through the end of January, we're continuing to see progress toward fully scaling the platform and we expect to see increased market activity given diminished originator profitability.
Our residential credit platform, which grew nearly 90% last year, remains diversified with the ability to deploy capital efficiently in either whole loans or securitized markets.
We've also benefited from new bulk partnerships established outside of our correspondent channel and altogether, these efforts helped drive the group's record $4.5 billion in whole loan purchases last year, which exceeded the amount of originations in both the prior two years combined.
Further, Onslow Bay remains a programmatic issuer of securitizations, pricing 13 whole loan transactions totaling $5.3 billion since the beginning of 2021 with OBX being the fourth largest nonbank issuer of prime jumbo and expanded prime MBS over the past two years.
First, we have thoughtfully reduced our economic leverage to one and a half turns since the onset of COVID to 5.7 times, the lowest it's been since 2014.
Our defensive leverage profile is further supported by our low capital structure leverage with 88% of our equity in common stock and minimal asset level structural leverage as highly liquid agency MBS make up the vast majority of our portfolio.
Second, we have substantial liquidity with $9.3 billion of unencumbered assets up $500 million year over year.
And finally, we are conservatively hedged to mitigate interest rate risk with a year-end hedge ratio of 95%, and we expect to remain close to fully hedged over the near term.
I've worked with Ilker at three different institutions for the better part of the past 20 years, and I cannot think of an individual more knowledgeable about mortgages and prepayments or better suited to help us drive success for Annaly into the future.
In fourth quarter, we reduced our agency holdings by roughly $5 billion, primarily through TBA sales, bringing the total 2021 portfolio reduction to $10 billion.
In lower coupons, we continue to favor TBAs, which maximize our liquidity profile and despite the initiation of the taper, dollar roll financing remains special in the context of 30 to 40 basis points.
In terms of our interest rate exposure, we adjusted hedges toward the front end of the yield curve by selling additional short-term treasury futures, which increased our hedge ratio to 95% of our liabilities.
Consistent with these trends, our portfolio paid 21.4 CPR in Q4, 7% slower than in Q3, and we expect a further deterioration of approximately 15% in Q1 of 2022.
With respect to our MSR platform, our fourth quarter purchases brought the portfolio to nearly $650 million in market value net of runoff.
Additionally, as David mentioned, with over $200 million in bulk MSR commitments in January and the recent price appreciation due to the sell-off in rates, our current MSR portfolio has reached nearly $1 billion in market value.
The economic value of residential credit portfolio grew by approximately $330 million quarter over quarter, primarily through the addition of $1.7 billion of whole loans, the retention of assets manufactured through our OBX securitization platform and the deployment of capital into short spread duration securities.
The residential credit portfolio ended Q4 with $4.6 billion of assets representing $3.1 billion of the firm's capital.
Lastly, our middle market lending portfolio had an active quarter closing nine deals totaling over $325 million in commitments, while five borrowers repaid.
Middle market lending ended the fourth quarter with nearly $2 billion in assets, up 4% from the prior quarter.
The portfolio's strong credit profile is demonstrated through a 10% increase in underlying borrowers' average EBITDA since closing and a nearly 30% reduction in system reserves throughout the year with no loans on non-accruals.
Notwithstanding this more difficult economic return environment, we have again delivered solid earnings and ample coverage, approximately 125% of our dividend.
Our book value per share was $7.97 for Q4, and we generated earnings available for distribution per share of $0.28.
Book value decreased $0.42 for the quarter primarily due to lower other comprehensive income of $680 million or $0.47 per share on higher rates and spread widening and the related declining valuations on our agency positions, as well as the common and preferred dividend declarations of $349 million or $0.24 per share, partially offset by GAAP net income of $418 million or $0.29 per share.
Our multifaceted hedging strategy continued to support the book value, albeit in a more muted fashion this quarter due to the aforementioned spread widening with swaps, futures and MSR valuations contributing $0.16 per share to the book value during the quarter.
Combining our book value performance with our fourth quarter dividend of $0.22, our quarterly and tangible economic returns were negative 2.4%.
Subsequent to quarter end, as Ilker and David both mentioned earlier, we continue to see significant spread widening impacting the valuation of our assets, which is partially offset by the benefit of our MSR investments and rate hedging strategy through January with our book value ending the month down 3% compared to December 31, 2021.
Diving deeper into the GAAP results, we generated GAAP net income for Q4 of $418 million or $0.27 per common share, net of preferred dividends, down from GAAP net income of $522 million or $0.34 per common share in the prior quarter.
The most significant drivers of lower GAAP income for the quarter is the unrealized losses on investments measured at fair value through earnings of $15 million in comparison to unrealized gains of $91 million in Q3 and realized losses on disposal of investments in the quarter of $25 million as compared to gains of $12 million in Q3 along with the previously referenced lower net gains on the swaps portfolio by $42 million.
As I mentioned earlier, the portfolio continued to generate strong income with EAD per share of $0.28, consistent with Q3 earnings, and we continue to generate strong earnings while prudently managing lower leverage resulting in an EAD ROE per unit of leverage of 2.3%.
Average yields remained flat at 2.63% compared to the prior quarter.
However, dollar roll income contributed to EAD in Q4 reaching another record level at $118.5 million.
The portfolio generated 203 basis points of NIM ex PAA, down one basis point from Q3 driven by the improved TBA dollar roll income, offset by higher swap expense on a lower average receive rate.
As I noted in the prior quarter, we have benefited from our ample liquidity position and the robust financing market during 2021 with the previous quarter marking nine consecutive quarters of reduced economic cost of funds for the company and our year-to-date economic cost of funds being 79 basis points, down 55 basis points in comparison to the prior year.
This upward trend along with higher swap rates impacted our overall cost of funds for the quarter rising by nine basis points to 75 basis points in Q4, and our average REPO rate for the quarter was 16 basis points compared to 15 basis points in the prior quarter.
Efficiency ratios improved by seven basis points in the fourth quarter with opex to equity of 1.21%.
And for the entire year, the opex to equity ratio was 1.35% compared to full year 2020 of 1.55% as we realize the benefits we projected from the reduction in compensation and other expenses following the disposition of our acreage business and the internalization of our management.
As a result of our continued build-out of our MSR and residential credit businesses, which are more labor-intensive and additional vesting of stock compensation issued in prior years, we anticipate that the range of opex to equity for 2022 and long range will be 1.4% to 1.55%.
And to wrap things up, Annaly maintained an abundant liquidity profile with $9.3 billion of unencumbered assets down modestly from the prior quarter at $9.8 billion, including cash and unencumbered Agency MBS of $5.2 billion.

Summary:
Diving deeper into the GAAP results, we generated GAAP net income for Q4 of $418 million or $0.27 per common share, net of preferred dividends, down from GAAP net income of $522 million or $0.34 per common share in the prior quarter.