This SO discussion proposes the following idiom:
public interface IComparable> {
int compare(T t);
}
You are correct: this idiom does not prevent classes from being compared to different classes. All it does is ensure that the compared object also implements the same interface. If there is a requirement to only compare the same types, that can be enforced by the implementing class.
What you call a "loophole" is what I would call "intentionally doing something you don't want to do".
Foo objects can be compared to A objects IF such behavior is desired.
This is a feature, not a loophole.
If you want Foo to be comparable to other Foos, you should define Foo to implement IComparable.
If you don't want Foo to be comparable to A, then you shouldn't define Foo to implement IComaparable. Why would anybody do that unless they were trying to write broken code on purpose?
The actual answer to your question has already been provided by @caskey:
"No, you can't do what you want using interfaces in Java. [You have to do it with classes]."
There is one thing that you missed:
Therefore (unless I've misunderstood something) the original idiom doesn't really buy anything more compared to the far less dramatic:
public interface IComparable
The original idiom does buy you something. It enforces that the compared object must implement IComparable. The less dramatic example would allow you to compare implementing classes to any object without restriction. So... The compiler would allow you to specify Long, or InputStream, or LinkedHashSet, or anything at all as a type parameter.
When you look at it that way, it's easy to see why this idiom is so common.