I have a reference which cites this theorem for real polynomials, but if I go through the proof perhaps this also works over other fields/euclidean domains possibly. Here it is :
Theorem. Let $f(x,y)$ be a polynomial with real coefficients and degree $d$. Let $a,b,c$ be real numbers, and let $L$ denote the set of points $(x,y)$ for which $ax + by + c = 0$. If the curve $f(x,y) = 0$ and $L$ have strictly more than $d$ distinct points in common, then there exists $k(x,y)$ with real coefficients such that
$$
f(x,y) = (ax+by+c)k(x,y).
$$
This is in Niven & Zuckerman's Introduction to the theory of numbers, so it's not focused on algebra. I'll edit this answer later if I see a reason why this would hold over some other fields, but the proof uses mainly the Taylor expansion of the polynomial (which can be done formally, without using differentiation in the "limit" sense).
Hope that helps,