It is not exactly possible (as it is also not by using a texture), but of course you can parametrize the surface of a sphere and compute the parameters of the point where the ray intersects, transform the parametrization into one suitable for coloring, and finally use the associated color.

Example:

1. Compute the intersection point in object local space using cartesian co-ordinates as usual.

2. Transform the cartesian co-ordinates into spherical co-ordinates.

3. Drop the radial co-ordinate and map the remaining by modulo calculations.

4. Pick a color due to the 2 modulo values.