Other answers cover what's going on implementation-wise, but I'd like to address the terminology, which I think lies at the root of the confusion:
Shouldn't calling .by_ref() on the iterator before calling .all prevent .all from consuming the iterator?
In Rust consume has a narrow definition related to ownership - a function "consuming" a value takes ownership of the value from the caller. Since the function is free to destroy the value or pass it along, the value is unavailable for further use by the caller that owned it originally.
In case of values implementing Iterator, methods that consume them, such as count() or sum(), typically also exhaust them (use them up). Other methods, such as map() or enumerate(), consume the iterator and return a new iterator, which will exhaust the original one provided that it is exhausted itself. But there are also methods like take() or scan, which consume the iterator without necessarily exhausting it, even when the iterator they return is fully exhausted. With such methods by_ref() comes in handy to keep the original iterator available for further processing:
let mut iter = 1..1000;
let sum_first_50 = iter.by_ref().take(50).sum();
let sum_second_50 = iter.by_ref().take(50).sum();
// ... iter available to produce the remaining 899 numbers ...
Without the by_ref() in the first line, the second line wouldn't compile because the first take() would consume (but not exhaust) iter. With by_ref() iter is neither consumed (because by_ref() protects it) nor exhausted (because we combined it with take()). Combining by_ref() with a method that both consumes and exhausts the iterator, such as count(), is well-defined but useless, because it will just leave you in possession of an exhausted iterator.
If you want to prevent the iterator from getting exhausted (or otherwise mutated), you can instead clone it:
fn main() {
let a = 1..10;
println!("{}", a.clone().all(|x| x < 10)); // true
println!("{}", a.count()); // 9
}