Using MSSQL 2005
I was playing around today with a Scalar UDF in a where statement to see some of the costs associated with making the call and io differences etc.
Purchases.CustomerID
you should put an index on it. As it is you are asking SQL server to choose between two bad plans.
SQL Server can guess roughly how many purchases will be covered by the > 1000
query, and will pick a plan based on that.
However it can't guess how many will be covered by the UDF query, so may pick a different plan. Because it is going on ignorance it might be better or worse than the other plan depending on how good it's guess is.
You can see the plans generated and it will tell you the estimated number of rows in each plan, and also the actual number. Those estimated numbers account for the choice of plan in each case.