Duration is a key variable in deciding value to bond investors investors. In fact, many investors have a duration target for their portfolio.  Duration changes differently for MBS vs Treasuries, and this contributes to differences in relative performance (e.g. when you see MBS not gaining as much ground as Treasuries during a rally).

A 10yr Treasury note will always have a 10yr duration (or more specifically, a predictably declining duration as time goes by). 

As rates rise, investors want less duration because they could get higher rates of return with newer debt. Whereas the duration of any 10yr Treasury note will be what it will be regardless of rising rates, the duration of the average mortgage would be getting longer (owners less likely to refi out of a below-market rate, and possibly even dissuaded from selling).

That creates excess duration in that investor's portfolio. In other words, if they were only holding 10yr Treasuries, they wouldn't have this problem of portfolio duration creeping higher. Their easiest move to shed duration would be to get rid of the bonds that have been adding more and more duration to their portfolio.  Simply put, MBS (in this example) are the squeaky wheel causing duration creep for the investor in question. And they get greased accordingly.

NOTE: this is far from the only consideration when it comes to examining relative gains/losses between Treasuries and MBS.  The Fed's bond buying preferences come into play, as well as the global demand for Treasuries during flights-to-safety (i.e. Treasuries tend to benefit more when investors demand safety and to lose ground to MBS when things calm down).

In the grand scheme of things, recent volatility in MBS vs Treasury performance is nothing like it used to be.  The financial crisis caused the biggest drama, but the QE3 announcement (in which the Fed announced MBS-specific buying plans in September 2012) was no slouch.

2018-10-23 negative convexity