It because of we cannot perform < (less than) operation on AnyVal type.
scala> val donut = Tuple2("Donut", 2.5)
donut: (String, Double) = (Donut,2.5)
scala> val plain = Tuple2("Plain", 1)
plain: (String, Int) = (Plain,1)
As you can see above. When you define Tuple2("Donut", 2.5), 2.5 is inferred to Double and in Tuple2("Plain", 1), 1 is inferred as Int since you have not provided type explicitly.
Now, when you create list of these tuples, because of type inference list type will be (String, AnyVal).
scala> val tuples = List(donut, plain)
tuples: List[(String, AnyVal)] = List((Donut,2.5), (Plain,1))
Now, when you are performing case x if x._2 < 2 you are actually comparing AnyVal type to number i.e. 2, which is not possible because compiler thinks that x._2 is AnyVal(not number) and won't compile. Therefore, you are getting exception at compile time.
<console>:22: error: value < is not a member of AnyVal
case x if (x._2 < 2) => "price under 2"
In your second case, i.e. when you defined tuple as Tuple2("Plain", 1.0), its number type is also inferred as Double.
scala> val donut = Tuple2("Donut", 2.5)
donut: (String, Double) = (Donut,2.5)
scala> val plain = Tuple2("Plain", 1.0)
plain: (String, Double) = (Plain,1.0)
And, when you create list of tuples, since both have same type i.e. (String, Double), list will have type List[(String, Double)].
scala> val tuples = List(donut, plain)
tuples: List[(String, Double)] = List((Donut,2.5), (Plain,1.0))
And x._2 < 2 will compile correctly since you are invoking < in double (number).