Gruyère cheese is too expensive here and I want make quiche lorràine. Is there some other cheese that I could substitute for the gruyère that would preserve the original flavor?
There are a couple variations that if you're lucky might be cheaper: Beaufort and Comté. (I've only actually tried Comté, but I've seen Beaufort listed along with it and Gruyère.)
A bit farther away are Emmentaler and Jarlsberg. They both have the Swiss cheese flavor but aren't quite as firm nicely aged. Beyond that there's simply all the varieties of (American) Swiss cheese, which are generally roughly like Emmanteler but likely even softer.
If you use one of the farther away substitutes, I'd suggest adding in some hard aged cheese as well to make up for the difference. For example, I've used (American) Swiss cheese plus dry jack and parmesan and been pretty happy with it. The specific hard aged cheese probably doesn't matter a whole lot, as long as it has some nice aged flavor and not a lot of overpowering other flavors.
If you want to be faithful to the French terminology, a quiche (lorraine) does not contain cheese. Ever. It's not even a matter of being "classic" or "authentic", putting cheese on a tarte is very common, but it's just called differently if you do (namely tarte). Have you ever tried an actual French quiche (i.e. without cheese)? Maybe you will like it.
Alternatively, you can put just about any cheese on it. Results will differ, hard somewhat aged cow-milk cheese like those suggested by @Jefromi will be closest to gruyère but anything goes really: Dutch cheese, soft cheese like maroilles or munster, blue cheese, goat cheese, feta cheese, feel free to experiment with what's available where you are.
Incidentally, if anything, I think it's actually more common to add a relatively bland, creamy cheese like emmentaler rather than a stronger older cheese to a tarte so there is no reason to consider the latter as the ingredient to be substituted or a tarte with gruyère as the "original flavor" to aim for.
Now if you like that and want to do it on the cheap, then maybe comté or beaufort are not very good options, as they might be just as expensive and possibly harder to find. I would try to look for an aged Dutch-like cheese (locally produced Gouda imitation or something like that).