Lines do lie in in a plane - well maybe not ‘a’ plane, rather an infinite number of them - so once you have a plane, one can test to see if a line is in it or not - both endpoints just have to be on the plane.
So, lines, while being theoretically planar curves, should not have a unique plane. However, it seems that in Rhino, if they are parallel to only one of the principal planes, they do get assigned that plane. That means that lines parallel to the X, Y and Z axes do not have a plane, but a diagonal line that lies on the world XY plane for example will get assigned that as a plane.
So, to make a script reliable, one maybe has to exclude lines as possible plane source objects - the one you choose first to compare others to - but, a simple test can determine if in fact they do lie in a chosen plane afterward.